Creating LTI Models creates the same tf model as H=tf([12],[10.60.9],0.1) Similarly, ('z',0.1) H=[z/(z+0.1)/(z+0.2);(z^2+0.2*z+0.1)/(z^2+0.2*z+0.01)] produces the single-input, two-output ZPK model Zero/pole/gain from input to output (z+0.1)(z+0.2) 0.1) (z+0.1)^2 ampl ing time: 0 Note that: The syntaxz= tf('z') is equivalent toz= tf('z',-1)and leaves the sample time unspecified. The same applies to z= zpk('z') Once you have defined z as indicated above, any rational expressions in z creates a discrete-time model of the same type and with the same sample time as z. Discrete transfer functions in dsP format In digital signal processing(DSP), it is customary to write discrete transfer functions as rational expressions in z and to order the numerator and denominator coefficients in ascending powers of rl. For example, the numerator and denominator of 1+0.5z1 1+2z1+3z would be specified as the row vectors 1 0. 5] and [1 2 3], respectively. When he numerator and denominator have different degrees, this convention
Creating LTI Models 2-21 creates the same TF model as H = tf([1 2], [1 0.6 0.9], 0.1); Similarly, z = zpk('z', 0.1); H = [z/(z+0.1)/(z+0.2) ; (z^2+0.2*z+0.1)/(z^2+0.2*z+0.01)] produces the single-input, two-output ZPK model Zero/pole/gain from input to output... z #1: --------------- (z+0.1) (z+0.2) (z^2 + 0.2z + 0.1) #2: ------------------ (z+0.1)^2 Sampling time: 0.1 Note that: • The syntax z = tf('z') is equivalent to z = tf('z',–1) and leaves the sample time unspecified. The same applies to z = zpk('z'). • Once you have defined z as indicated above, any rational expressions in z creates a discrete-time model of the same type and with the same sample time as z. Discrete Transfer Functions in DSP Format In digital signal processing (DSP), it is customary to write discrete transfer functions as rational expressions in and to order the numerator and denominator coefficients in ascending powers of . For example, the numerator and denominator of would be specified as the row vectors [1 0.5] and [1 2 3], respectively. When the numerator and denominator have different degrees, this convention z–1 z–1 H z–1 ( ) 1 0.5z–1 + 1 2z–1 3z–2 + + = ---------------------------------------
2 LTI Models clashes with the"descending powers of z convention assumed by tf(see Transfer Function Models"on page 2-8, or tf). For example h=tf(I10.5],[123) produces the transfer function +0.5 hich differs from H(2)by a factor z To avoid such convention clashes, the Control System Toolbox offers a separate function fil t dedicated to the DSP-like specification of transfer functions. Its syntax is for discrete transfer functions with unspecified sample time, and h= filt( to further specify the sample time Ts. This function creates TF objects just like tf, but expects num and den to list the numerator and denominator coefficients in ascending powers of t. For example, typing h=filt([10.5].[123]) Transfer functi on: 1+2z^-1+3 Sampl ing time: unspeci fi You can also use fi l t to specify mIMo transfer functions in z. Just as for tf, the input arguments num and den are then cell arrays of row vectors of appropriate dimensions(see"Transfer Function Models"on page 2-8 for details). Note that each row vector should comply with the"ascending powers of zI"convention
2 LTI Models 2-22 clashes with the “descending powers of ” convention assumed by tf (see “Transfer Function Models” on page 2-8, or tf). For example, h = tf([1 0.5],[1 2 3]) produces the transfer function which differs from by a factor . To avoid such convention clashes, the Control System Toolbox offers a separate function filt dedicated to the DSP-like specification of transfer functions. Its syntax is h = filt(num,den) for discrete transfer functions with unspecified sample time, and h = filt(num,den,Ts) to further specify the sample time Ts. This function creates TF objects just like tf, but expects num and den to list the numerator and denominator coefficients in ascending powers of . For example, typing h = filt([1 0.5],[1 2 3]) produces Transfer function: 1 + 0.5 z^–1 ------------------- 1 + 2 z^–1 + 3 z^–2 Sampling time: unspecified You can also use filt to specify MIMO transfer functions in . Just as for tf, the input arguments num and den are then cell arrays of row vectors of appropriate dimensions (see “Transfer Function Models” on page 2-8 for details). Note that each row vector should comply with the “ascending powers of ” convention. z z + 0.5 z2 + + 2z 3 --------------------------- H z–1 ( ) z z–1 z–1 z–1
Creating LTI Models Data retrieval The functions tf, zpk, ss, and frd pack the model data and sample time in a retrieval for any type of TF, SS, or ZPK model sys, or FRD mode\ sysfr, single Lti object. Conversely, the following commands provide convenient data Inum, den, Ts]= tfdata(sys) npl e ti [z, P, k, Ts] zpkdata( sys) [a, b, c, d, Ts]= ssdata(sys) [ a, b, c, d, e, Ts] dssdata( sys) sys can be any type of LTI object, except an FRD model sysfr, the input argument to frdata, can only be an FRD model You can use any variable names you want in the output argument list of any of these functions. The ones listed here correspond to the model property names The output arguments num and den assigned to tfdata, and z and p assigned to zpkdata, are cell arrays, even in the SISo case. These cell arrays have as nany rows as outputs, as many columns as inputs, and their jth entry specifies the transfer function from the th input to the ith output. For example H=[tf([1-1],[12101),tf(1,[1o1) creates the one-output/two-input transfer function +2s+10 Typing [num, den]= tfdata(H) um{1,1},den{1,1} displays the coefficients of the numerator and denominator of the first input 0
Creating LTI Models 2-23 Data Retrieval The functions tf, zpk, ss, and frd pack the model data and sample time in a single LTI object. Conversely, the following commands provide convenient data retrieval for any type of TF, SS, or ZPK model sys, or FRD model sysfr. [num,den,Ts] = tfdata(sys) % Ts = sample time [z,p,k,Ts] = zpkdata(sys) [a,b,c,d,Ts] = ssdata(sys) [a,b,c,d,e,Ts] = dssdata(sys) [response,frequency,Ts] = frdata(sysfr) Note that: • sys can be any type of LTI object, except an FRD model • sysfr, the input argument to frdata, can only be an FRD model You can use any variable names you want in the output argument list of any of these functions. The ones listed here correspond to the model property names described in Tables 2-2 – 2.5. The output arguments num and den assigned to tfdata, and z and p assigned to zpkdata, are cell arrays, even in the SISO case. These cell arrays have as many rows as outputs, as many columns as inputs, and their ijth entry specifies the transfer function from the jth input to the ith output. For example, H = [tf([1 –1],[1 2 10]) , tf(1,[1 0])] creates the one-output/two-input transfer function Typing [num,den] = tfdata(H); num{1,1}, den{1,1} displays the coefficients of the numerator and denominator of the first input channel. ans = 0 1 –1 ans = H s( ) s – 1 s2 + + 2s 10 ------------------------------ 1 s = --
2 LTI Models Note that the same result is obtained using H.num{1,1},丑.den{1,1} See"Direct Property Referencing"on page 2-31 for more information about this To obtain the numerator and denominator of Siso systems directly as row en, Ts]= tfdata (sy For example, typing ([13],[1251) [num, den]= tfdata(sys, 'V') [z, p, k, Ts]= zpkdata( sys, 'V') returns the zeros, z, and the poles, P, as vectors for SISO systems
2 LTI Models 2-24 1 2 10 Note that the same result is obtained using H.num{1,1}, H.den{1,1} See “Direct Property Referencing” on page 2-31 for more information about this syntax. To obtain the numerator and denominator of SISO systems directly as row vectors, use the syntax [num,den,Ts] = tfdata(sys,'v') For example, typing sys = tf([1 3],[1 2 5]); [num,den] = tfdata(sys,'v') produces num = 0 1 3 den = 1 2 5 Similarly, [z,p,k,Ts] = zpkdata(sys,'v') returns the zeros, z, and the poles, p, as vectors for SISO systems
LTI Properti LTI Pre operties The previous section shows how to create LTi objects that encapsulate the information, such as the input names or notes on the model history, toli Q model data and sample time. You also have the option to attribute additiona objects. This section gives a complete overview of the LTI properties, i.e., the various pieces of information that can be attached to the TF, ZPK, Ss, and FRD objects. Type hel p lti props for online help on available LTI properties From a data structure standpoint, the lti properties are the various fields in he tF ZPK, SS, and FRD objects. These fields hav ames(the property names)and are assigned values( the property values). We distinguish between generic properties, common to all four types of LTI objects, and model-specific properties that pertain only to one particular type of model. Generic Properties The generic properties are those shared by all four types of lTi models(tf, ZPK, SS, and FRD objects). They are listed in the table below. Table 2-4: Generic LTI Properties Property Name Description Property Value 1/0 delay(s) Matrix Input Del ay Input delay (s) Vector put ch anI Cell array I nputName Input channel names Cell vec strings Notes on the model history Text Out put Del ay Output delay(s) Vector Output Group Output channel group: Cell array Output Name Output channel names Cell vector of strings Sample time Scalar Userdata Additional data Arbitrary 2-25
LTI Properties 2-25 LTI Properties The previous section shows how to create LTI objects that encapsulate the model data and sample time. You also have the option to attribute additional information, such as the input names or notes on the model history, to LTI objects. This section gives a complete overview of the LTI properties, i.e., the various pieces of information that can be attached to the TF, ZPK, SS, and FRD objects. Type help ltiprops for online help on available LTI properties. From a data structure standpoint, the LTI properties are the various fields in the TF, ZPK, SS, and FRD objects. These fields have names (the property names) and are assigned values (the property values). We distinguish between generic properties, common to all four types of LTI objects, and model-specific properties that pertain only to one particular type of model. Generic Properties The generic properties are those shared by all four types of LTI models (TF, ZPK, SS, and FRD objects). They are listed in the table below. Table 2-4: Generic LTI Properties Property Name Description Property Value ioDelay I/O delay(s) Matrix InputDelay Input delay(s) Vector InputGroup Input channel groups Cell array InputName Input channel names Cell vector of strings Notes Notes on the model history Text OutputDelay Output delay(s) Vector OutputGroup Output channel groups Cell array OutputName Output channel names Cell vector of strings Ts Sample time Scalar Userdata Additional data Arbitrary