2 LTI Models because parallel connection amounts to adding the transfer matrices. Similarly, subsystems of a given LTI model sys can be extracted using matrix-like subscripting. For instance provides the lO relation between the first two inputs(column indices)and the third output(row index), which is consistent with H(2,1)H(2,2)u1u2 H(3,1)H(3,2) Command Summary The next two tables give an overview of the main commands you can apply to LTI models Table 2-1: Creating lti models Command Description Generate random discrete state-space model Create descriptor state-space model filt Create discrete filter with dsP convention frd Create an frd model frat a Retrieve frd model data Query LTi model properties Set LTI model proper Generate random continuous state-space model. Create a state-space model 2-6
2 LTI Models 2-6 sys = sys1 + sys2 because parallel connection amounts to adding the transfer matrices. Similarly, subsystems of a given LTI model sys can be extracted using matrix-like subscripting. For instance, sys(3,1:2) provides the I/O relation between the first two inputs (column indices) and the third output (row index), which is consistent with for . Command Summary The next two tables give an overview of the main commands you can apply to LTI models. Table 2-1: Creating LTI Models Command Description drss Generate random discrete state-space model. dss Create descriptor state-space model. filt Create discrete filter with DSP convention. frd Create an FRD model. frdata Retrieve FRD model data. get Query LTI model properties. set Set LTI model properties. rss Generate random continuous state-space model. ss Create a state-space model. y1 y2 y3 H( ) 1 1, H( ) 2 1, H( ) 2 1, H( ) 2 2, H( ) 3 1, H( ) 3 2, u1 u2 = y Hu =
Table 2-1: Creating LTI Models (Continued) Command Description ssdata, dssdata Retrieve state-space data(respectively, descriptor data) tf Create a transfer function tfdata Retrieve transfer function data Create a zero-pole-gain model zpkdata Retrieve zero pole-gain data Table 2-2: Converting LtI Models Command Description Continuous- to discrete-time conversion Discrete- to continuous-time conversion d2d Resampling of discrete-time models. Conversion to an frd model Pade approximation of input delays Conversion to state space. tf Conversion to transfer function Conversion to zero-pole-gain 2-7
2-7 ssdata, dssdata Retrieve state-space data (respectively, descriptor state-space data). tf Create a transfer function. tfdata Retrieve transfer function data. zpk Create a zero-pole-gain model. zpkdata Retrieve zero-pole-gain data. Table 2-2: Converting LTI Models Command Description c2d Continuous- to discrete-time conversion. d2c Discrete- to continuous-time conversion. d2d Resampling of discrete-time models. frd Conversion to an FRD model. pade Padé approximation of input delays. ss Conversion to state space. tf Conversion to transfer function. zpk Conversion to zero-pole-gain. Table 2-1: Creating LTI Models (Continued) Command Description
2 LTI Models Creating LtI Models The functions tf, zpk, ss, and frd create transfer function models zero-pole-gain models, state-space models, and frequency response data models, respectively. These functions take the model data as input and produce TF, ZPK, SS, or FRD objects that store this data in a single MATLAB variable This section shows how to create continuous or discrete siso or MIMo lti models with tf, zpk, ss, and frd Note You can only specify TE, ZPK, and Ss models for systems whose transfer matrices have real-valued coefficients Transfer Function models This section explains how to specify continuous-time SISO and MIMO transfer function models. The specification of discrete-time transfer function models is a simple extension of the continuous-time case(see"Discrete-Time Models"on page 2-19). In this section you can also read about how to specify transfer functions consisting of pure gains SISO Transfer Function models A continuous-time siso transfer function h(s) n(S) is characterized by its numerator n(s)and denominator d(s), both polynomials of the Laplace variable s There are two ways to specify SISo transfer functions As rational expressions in the Laplace variable s To specify a SISo transfer function model h(s)=n(s)/d(s) using the tf mmand, type 2-8
2 LTI Models 2-8 Creating LTI Models The functions tf, zpk, ss, and frd create transfer function models, zero-pole-gain models, state-space models, and frequency response data models, respectively. These functions take the model data as input and produce TF, ZPK, SS, or FRD objects that store this data in a single MATLAB variable. This section shows how to create continuous or discrete, SISO or MIMO LTI models with tf, zpk, ss, and frd. Note You can only specify TF, ZPK, and SS models for systems whose transfer matrices have real-valued coefficients. Transfer Function Models This section explains how to specify continuous-time SISO and MIMO transfer function models. The specification of discrete-time transfer function models is a simple extension of the continuous-time case (see “Discrete-Time Models” on page 2-19). In this section you can also read about how to specify transfer functions consisting of pure gains. SISO Transfer Function Models A continuous-time SISO transfer function is characterized by its numerator and denominator , both polynomials of the Laplace variable s. There are two ways to specify SISO transfer functions: • Using the tf command • As rational expressions in the Laplace variable s To specify a SISO transfer function model using the tf command, type h = tf(num,den) h s( ) n s( ) d s( ) = ----------- n s( ) d s( ) h s( ) = n s( ) ⁄ d s( )
Creating LTI Models where num and den are row vectors listing the coefficients of the polynomials n(s)and d(s), respectively, when these polynomials are ordered in descending powers of s. The resulting variable h is a tF object containing the numerator and denominator data For example, you can create the transfer function h(s)=s/(s2+2s+ 10) by typing h=tf([101,[1210]) MATLAB responds with Transfer functi on +2 Note the customized display used for tF object You can also specify transfer functions as rational expressions in the laplace variable s by 1 Defining the variable s as a special TF model 2 Entering your transfer function as a rational expression in s For example, once s is defined with tf as in 1. H=s/(s^2 produces the same transfer function as h=tf([101,[12101); Note You need only define the variable s as a TF model once. All of the subsequent models you create using rational expressions of s are specified as Objects, unless you convert the variable s to ZPK. See "Model Conversion on page 2-40 for more information 2-9
Creating LTI Models 2-9 where num and den are row vectors listing the coefficients of the polynomials and , respectively, when these polynomials are ordered in descending powers of s. The resulting variable h is a TF object containing the numerator and denominator data. For example, you can create the transfer function by typing h = tf([1 0],[1 2 10]) MATLAB responds with Transfer function: s -------------- s^2 + 2 s + 10 Note the customized display used for TF objects. You can also specify transfer functions as rational expressions in the Laplace variable s by: 1 Defining the variable s as a special TF model s = tf('s'); 2 Entering your transfer function as a rational expression in s For example, once s is defined with tf as in 1, H = s/(s^2 + 2*s +10); produces the same transfer function as h = tf([1 0],[1 2 10]); Note You need only define the variable s as a TF model once. All of the subsequent models you create using rational expressions of s are specified as TF objects, unless you convert the variable s to ZPK. See “Model Conversion” on page 2-40 for more information. n s( ) d s( ) h s( ) s s2 = ⁄ ( ) + + 2s 10
2 LTI Models AIMO Transfer function models MIMO transfer functions are two-dimensional arrays of elementary SIso transfer functions. There are several ways to specify MIMo transfer function models, including Concatenation of siso transfer function models Using tf with cell array arguments Consider the rational transfer matrix can specify H(s) by concatenation of its sisO entries. For instance, 11=tf([1-1],[11]) h21=tf([12],[145]) or, equivalently, h11=(s-1)/(s+1) h21=(s+2)/(s^2+4*s+5) can be concatenated to form H(s) H=[h1l;h21 This syntax mimics standard matrix concatenation and tends to be easier and more readable for MIMO systems with many inputs and/or outputs. See"Model Interconnection Functions "on page 3-16 for more details on concatenation operations for LTI systems. Alternatively, to define MiMo transfer functions using tf, you need two cell arrays(say, N and d) to represent the sets of numerator and denominator polynomials, respectively. See Chapter 13, "Structures and Cell Arrays"in Using MATLAB for more details on cell arrays For example, for the rational transfer matrix H(s), the two cell arrays N and d should contain the row-vector representations of the polynomial entries of 2-10
2 LTI Models 2-10 MIMO Transfer Function Models MIMO transfer functions are two-dimensional arrays of elementary SISO transfer functions. There are several ways to specify MIMO transfer function models, including: • Concatenation of SISO transfer function models • Using tf with cell array arguments Consider the rational transfer matrix . You can specify by concatenation of its SISO entries. For instance, h11 = tf([1 –1],[1 1]); h21 = tf([1 2],[1 4 5]); or, equivalently, s = tf('s') h11 = (s–1)/(s+1); h21 = (s+2)/(s^2+4*s+5); can be concatenated to form . H = [h11; h21] This syntax mimics standard matrix concatenation and tends to be easier and more readable for MIMO systems with many inputs and/or outputs. See “Model Interconnection Functions” on page 3-16 for more details on concatenation operations for LTI systems. Alternatively, to define MIMO transfer functions using tf, you need two cell arrays (say, N and D) to represent the sets of numerator and denominator polynomials, respectively. See Chapter 13, “Structures and Cell Arrays” in Using MATLAB for more details on cell arrays. For example, for the rational transfer matrix , the two cell arrays N and D should contain the row-vector representations of the polynomial entries of H s( ) s – 1 s + 1 ----------- s + 2 s2 + + 4s 5 --------------------------- = H s( ) H s( ) H s( )