2 LTI Models In addition to the A, B, C, and D matrices, the display of state-space models cludes state names, input names, and output names. Default names(here, x1, x2, ul, and y1)are displayed whenever you leave these unspecified. See LTI Properties" on page 2-25 for more information on how to specify state, input, or output names Descriptor state-Space Models Descriptor state-space(DSS)models are a generalization of the standard state-space models discussed above. They are of the form d Ax+ Bu y= Cx+ Du The Control System Toolbox supports only descriptor systems with a nonsingular E matrix. While such models have an equivalent explicit form dx (E14)x+(E-1B)u di Cx+D it is often desirable to work with the descriptor form when the e matrix is poorly conditioned with respect to inversion The function dss is the counterpart of ss for descriptor state-space models Specifically, sys =dss(A, B. C, D, E) creates a continuous-time dss model with matrix data.bcd e for example, consider the dynamical model with vector o of angular velocities. If the inertia matrix J is poorly conditioned with respect to inversion, you can specify this system as a descriptor model by sys dss(-F, eye(n), eye(n),0, J) %n =length of vector o
2 LTI Models 2-16 In addition to the A, B, C, and D matrices, the display of state-space models includes state names, input names, and output names. Default names (here, x1, x2, u1, and y1) are displayed whenever you leave these unspecified. See “LTI Properties” on page 2-25 for more information on how to specify state, input, or output names. Descriptor State-Space Models Descriptor state-space (DSS) models are a generalization of the standard state-space models discussed above. They are of the form The Control System Toolbox supports only descriptor systems with a nonsingular matrix. While such models have an equivalent explicit form it is often desirable to work with the descriptor form when the matrix is poorly conditioned with respect to inversion. The function dss is the counterpart of ss for descriptor state-space models. Specifically, sys = dss(A,B,C,D,E) creates a continuous-time DSS model with matrix data A,B,C,D,E. For example, consider the dynamical model with vector of angular velocities. If the inertia matrix is poorly conditioned with respect to inversion, you can specify this system as a descriptor model by sys = dss(–F,eye(n),eye(n),0,J) % n = length of vector E dx dt ------ = Ax Bu + y Cx Du = + E dx dt ------ = ( ) E–1A x E + ( ) –1B u y Cx Du = + E Jdω dt ------- + Fω = T y = ω ω J ω
Creating LTI Models Frequency Response Data(FRD)Models In some instances, you may only have sampled frequency response data, rather than a transfer function or state-space model for the system you want to analyze or control. For information on frequency response analysis of linear systems, see Chapter 8 of [1] For example, suppose the frequency response function for the SISO system you want to model is G(w). Suppose, in addition, that you perform an experiment to evaluate G(w)at a fixed set of frequencies, W,, W,, .. w. You can do this by driving the system with a sequence of sinusoids at each of these frequencies, as G(w) yat Here w, is the input frequency of each sinusoid, i=1.n, and G(w) I G(wlexp(zG(w)). The steady state output response of this system satisfies yat) A frequency response data(FrD) object is a model form you can use to store frequency response data(complex frequency response, along with a corresponding vector of frequency points) that you obtain either throug simulations or experimentally In this example, the frequency response data is obtained from the set of response pairs: [(G(w), wil,i Once you store your data in an FRD model, you can treat it as an LTI model, and manipulate an FRD model in most of the same ways you manipulate TF, SS and ZPK models. The basic syntax for creating a SISO FRD model is sys frd(response, frequenc es, uni ts) frequencies is a real vector of length Nf 2-17
Creating LTI Models 2-17 Frequency Response Data (FRD) Models In some instances, you may only have sampled frequency response data, rather than a transfer function or state-space model for the system you want to analyze or control. For information on frequency response analysis of linear systems, see Chapter 8 of [1]. For example, suppose the frequency response function for the SISO system you want to model is G(w). Suppose, in addition, that you perform an experiment to evaluate G(w) at a fixed set of frequencies, . You can do this by driving the system with a sequence of sinusoids at each of these frequencies, as depicted below. Here is the input frequency of each sinusoid, i = 1 ... n, and G(w) = . The steady state output response of this system satisfies A frequency response data (FRD) object is a model form you can use to store frequency response data (complex frequency response, along with a corresponding vector of frequency points) that you obtain either through simulations or experimentally. In this example, the frequency response data is obtained from the set of response pairs: . Once you store your data in an FRD model, you can treat it as an LTI model, and manipulate an FRD model in most of the same ways you manipulate TF, SS, and ZPK models. The basic syntax for creating a SISO FRD model is sys = frd(response,frequencies,units) where • frequencies is a real vector of length Nf. w1 w2 … wn , ,, wi sin t G(w) = yi ( )t wi G w( ) exp( ) j Gw ∠ ( ) yi ( )t G wi ( ) wi t Gwi = = sin 1 ( ) + ∠ ( ) ; i …n G wi ( ) wi { } ( ,) , i = 1…n
2 LTI Models response is a vector of length Nf of complex frequency response values for units is an optional string for the units of frequency: either 'rad/s'(default) For example, the MAT-file LTI exampl es mat contains a frequency vector freq and a corresponding complex frequency response data vector respG. To load this frequency-domain data and construct an FRD model, type LTI exampl sys = frd(respG, fr Conti nuous-ti me frequency response wi th 1 out put and 1 input t 5 frequency points -0.812505-0.000312i 0.092593 0.043735-0.000390i The syntax for creating a MIMO FRD model is the same as for the siso case except that response is a p-by-m-by-Nfmultidimensional array, where pis the number of outputs, m is the number of inputs, and Nfis the number of frequency data points(the length of frequency) The following table summarizes the complex-valued response data format for Table 2-3: Data Format for the Argument response in FRD Models Model form Response Data Format SISO model Vector of length Nf for which response(i) is the frequency response at the frequency frequency (i)
2 LTI Models 2-18 • response is a vector of length Nf of complex frequency response values for these frequencies. • units is an optional string for the units of frequency: either 'rad/s' (default) or 'Hz' For example, the MAT-file LTIexamples.mat contains a frequency vector freq, and a corresponding complex frequency response data vector respG. To load this frequency-domain data and construct an FRD model, type load LTIexamples sys = frd(respG,freq) Continuous-time frequency response with 1 output and 1 input at 5 frequency points. From input 1 to: Frequency(rad/s) output 1 ---------------- -------- 1 –0.812505 –0.000312i 2 –0.092593 –0.462963i 4 –0.075781 –0.001625i 5 –0.043735 –0.000390i The syntax for creating a MIMO FRD model is the same as for the SISO case, except that response is a p-by-m-by-Nf multidimensional array, where p is the number of outputs, m is the number of inputs, and Nf is the number of frequency data points (the length of frequency). The following table summarizes the complex-valued response data format for FRD models. Table 2-3: Data Format for the Argument response in FRD Models Model Form Response Data Format SISO model Vector of length Nf for which response(i) is the frequency response at the frequency frequency(i)
Creating LTI Models Table 2-3: Data Format for the Argument response in FRD Models(Continued) Model form Response Data Format MIMO model Ny-by-Nu-by-Nf multidimensional array forwhich with Ny outputs response(i,j, k) specifies the frequency response nd Nu inpl nputj to output i at frequenc S1-by-..-by-Sn Ny-by-Nu-by-S1-by-..-by-Sn multidimensional array, array of models for which response(i, j, k, )specifies the array of with Ny outputs frequency response data from input to output i at and Nu inputs frequency frequency(k) Discrete-Time models Creating discrete-time models is very much like creating continuous-time models, except that you must also specify a sampling period or sample time for discrete-time models. The sample time value should be scalar and expressed in seconds. You can also use the value -l to leave the sample time unspecified To specify discrete-time LTi models using tf, zpk, ss, or frd, simply append the desired sample time value Ts to the list of inputs. sys1= tf(num, den, Ts) sys2= zpk(z, p, k, Ts) sys3= ss(a, b, c, d, Ts) requency. For example, h=tf([1-1].[1-0.51,0.1) creates the discrete-time transfer function h(z)=(z-1)/(z-0.5) with sample time 0. 1 seconds, and sys Ss(A, B, C, D, 0. 5) specifies the discrete-time state-space model x[n+ 1]= Axn]+ Buln yn]= Cx[n]+ Du[n] with sampling period 0.5 second. The vectors x[n], u[n], yn] denote the values of the state, input, and output vectors at the nth sample 2-19
Creating LTI Models 2-19 Discrete-Time Models Creating discrete-time models is very much like creating continuous-time models, except that you must also specify a sampling period or sample time for discrete-time models. The sample time value should be scalar and expressed in seconds. You can also use the value –1 to leave the sample time unspecified. To specify discrete-time LTI models using tf, zpk, ss, or frd, simply append the desired sample time value Ts to the list of inputs. sys1 = tf(num,den,Ts) sys2 = zpk(z,p,k,Ts) sys3 = ss(a,b,c,d,Ts) sys4 = frd(response,frequency,Ts) For example, h = tf([1 –1],[1 –0.5],0.1) creates the discrete-time transfer function with sample time 0.1 seconds, and sys = ss(A,B,C,D,0.5) specifies the discrete-time state-space model with sampling period 0.5 second. The vectors denote the values of the state, input, and output vectors at the nth sample. MIMO model with Ny outputs and Nu inputs Ny-by-Nu-by-Nf multidimensional array for which response(i,j,k) specifies the frequency response from input j to output i at frequency frequency(k) S1-by-...-by-Sn array of models with Ny outputs and Nu inputs Ny-by-Nu-by-S1-by-...-by-Sn multidimensional array, for which response(i,j,k,:) specifies the array of frequency response data from input j to output i at frequency frequency(k) Table 2-3: Data Format for the Argument response in FRD Models (Continued) Model Form Response Data Format h z( ) = ( ) z – 1 ⁄ ( ) z – 0.5 x n[ ] + 1 = Ax n[ ] + Bu n[ ] y n[ ] = Cx n[ ] + Du n[ ] x n[ ], , u n[ ] y n[ ]
2 LTI Models By convention, the sample time of continuous-time models is Ts =0. Setting Ts=-1 leaves the sample time of a discrete-time model unspecified. For Transfer functi on ng time: unspeci fied Note Do not simply omit Ts in this case. This would make h a continuous-time transfer function If you forget to specify the sample time when creating your model, you can still set it to the correct value by reassigning the lti property Ts. See"Sample Time"on page 2-33 for more information on setting this property Discrete- Time tf and ZPk Models You can specify discrete-time TF and ZPK models using tf and zpk as indicated above. Alternatively, it is often convenient to specify such models by 1 Defining the variable z as a particular discrete-time TF or ZPK model with the appropriate sample time 2 Entering your TF or ZPK model directly as a rational expression in z. This approach parallels the procedure for specifying continuous-time TF or ZPK models using rational expressions. This procedure is described in"SISO Transfer Function Models"on page 2-8 and "SISO Zero-Pole-Gain Models"or H=(z+2)/(z^2+0.6*z+0.9)
2 LTI Models 2-20 By convention, the sample time of continuous-time models is Ts = 0. Setting Ts = –1 leaves the sample time of a discrete-time model unspecified. For example, h = tf([1 –0.2],[1 0.3],–1) produces Transfer function: z – 0.2 ------- z + 0.3 Sampling time: unspecified Note Do not simply omit Ts in this case. This would make h a continuous-time transfer function. If you forget to specify the sample time when creating your model, you can still set it to the correct value by reassigning the LTI property Ts. See “Sample Time” on page 2-33 for more information on setting this property. Discrete-Time TF and ZPK Models You can specify discrete-time TF and ZPK models using tf and zpk as indicated above. Alternatively, it is often convenient to specify such models by: 1 Defining the variable z as a particular discrete-time TF or ZPK model with the appropriate sample time 2 Entering your TF or ZPK model directly as a rational expression in z. This approach parallels the procedure for specifying continuous-time TF or ZPK models using rational expressions. This procedure is described in “SISO Transfer Function Models” on page 2-8 and “SISO Zero-Pole-Gain Models” on page 2-12. For example, z = tf('z', 0.1); H = (z+2)/(z^2 + 0.6*z + 0.9);