实验一状态空间模型的建立与状态响应分析EXPERIMENT1Modeling with State Space Description and AnalysisofTimeResponsebyMATLABI.ExperimentalPurpose1. Obtaining the state space model and Conversion between different models: statespace model & transfer function.2. Obtaining the diagonal canonical form and Jordan canonical form by statetransformation3.Calculation of the time response of theLTI systemI.ExperimentalContent1.1 The state space description of the system is[2.254-5-1.250.56]242.25-4.25-1.250.25X(t) =X(t)u(t)0.250.5-1.252-12021.250.75-1.75-0.25000X(t)(t)01001.1.1 Modeling with the state space descriptionThis equation can be input to the MATLABwork space by the followingstatement.A-[2.25,-5,-1.25,-0.5;2.25,-4.25,-1.25,-0.25;-0.25,-0.5,-1.25,-1;1.25,-1.75,-0.25,0.75];B=[4,6;2,4;2,2;0,2];C=[1,0,0,0;0,1,0,0];D=zeros(2,2),G=ss(A,B,C,D)
1 实验一 状态空间模型的建立与状态响应分析 EXPERIMENT1 Modeling with State Space Description and Analysis of Time Response by MATLAB I. Experimental Purpose 1. Obtaining the state space model and Conversion between different models: state space model & transfer function. 2. Obtaining the diagonal canonical form and Jordan canonical form by state transformation 3. Calculation of the time response of the LTI system II. Experimental Content 1.1 The state space description of the system is 2.25 5 1.25 0.5 4 6 2.25 4.25 1.25 0.25 2 4 ( ) ( ) ( ) 0.25 0.5 1.25 1 2 2 1.25 1.75 0.25 0.75 0 2 X t X t u t − − − −−− = + − − − − −−− 1 0 0 0 ( ) ( ) 0 1 0 0 y t t = X 1.1.1 Modeling with the state space description This equation can be input to the MATLAB work space by the following statement. A=[2.25,-5,-1.25,-0.5;2.25,-4.25,-1.25,-0.25;-0.25,-0.5,-1.25,-1;1.25,-1.75,-0.25,- 0.75]; B=[4,6;2,4;2,2;0,2]; C=[1,0,0,0;0,1,0,0]; D=zeros(2,2); G=ss(A,B,C,D)
1.1.2 Conversion of state space model established by 1.1.1 as the transferfunction modelThemodel oftransferfunction can be obtainedby thefollowing statementsG1=tf(G)or[Num1,den1]=ss2tf(A,B,C,D,1)[Num2,den2]=ss2tf(A,B,C,D,2)1.2Themodel ofthesystem iss+5G(s) =s*+2s3+3s2+4s+51.2.1Setupthemodel ofthetransferfunctionofthesystemTransfer function can be input to the MATLAB work space by the followingstatements.num=[1,5];den=[1,2,3,4,5],G=tf(num,den)1.2.2 Conversion of the transfer function established by 1.2.1 as the state spacedescription[A,B,C,D]-tf2ss(num,den);G1=ss(A,B,C,D)orG2=ss(G)%不推荐使用1.3Thestatespacedescriptionof thesystemis[1 0-11X=0011X+0Z[2][0 0 2]y=[1 2 1]Transform the state space description into the diagonal canonical formThe transformation can be executed bythe following statements.2
2 1.1.2 Conversion of state space model established by 1.1.1 as the transfer function model The model of transfer function can be obtained by the following statements: G1=tf(G) or [Num1,den1]=ss2tf(A,B,C,D,1) [Num2,den2]=ss2tf(A,B,C,D,2) 1.2 The model of the system is 2 3 4 5 5 ( ) 4 3 2 + + + + + = s s s s s G s 1.2.1 Set up the model of the transfer function of the system Transfer function can be input to the MATLAB work space by the following statements. num=[1,5];den=[1,2,3,4,5],G=tf(num,den) 1.2.2 Conversion of the transfer function established by 1.2.1 as the state space description [A,B,C,D]=tf2ss(num,den); G1=ss(A,B,C,D) or G2=ss(G) %不推荐使用 1.3 The state space description of the system is [1 2 1] 2 0 1 0 0 2 0 1 0 1 0 1 = + − = y X X u Transform the state space description into the diagonal canonical form. The transformation can be executed by the following statements
A=[1 0 -1;0 1 0;0 0 2]; b=[1 0 2];c=[1 2 1];d=0;[V,D]=eig(A);,[Ap,Bp,Cp,Dp]=ss2ss(A,b,c,d,inv(V))1.4The state space description of the system is[07[010]X=001x+02[230]1y=[1 0 ]xTransform the state space description into the Jordan canonical form and thetransformation can be executed bythe following statements.A=[010:001;230];b=[001];c=[1011;d=0[V,J=jordan (A);[Ap,Bp,Cp,Dp]=ss2ss(A,b,c,d,inv(V)) or%不推荐使用[Aj,Bj,Cj,Dil=canon(A,b,c,d,'modal)1.5Consider a LTI system described by the following state space description[。 1]x(0)+10u(),X(0)=X(t)=-2 -3119y(t)=[1 2]X(0)1.5.1Determine the matrix exponiential function e4rThe matrix exponiential function can be derived by the following statements:A=[0 1:-2 -3];syms teAt=expm(A*t)1.5.2 Find the zero input response of the system in the period [0, 6s]It can becalculated bythefollowing statements%Zero input responseA=[0,1;-2 -3]; B=[0;1];C=[1,2];D=[0];X0=[1;2]3
3 A=[1 0 -1;0 1 0;0 0 2]; b=[1 0 2]';c=[1 2 1];d=0; [V,D]=eig(A); [Ap,Bp,Cp,Dp]=ss2ss(A,b,c,d,inv(V)) 1.4 The state space description of the system is y X u [1 0 1] 1 0 0 2 3 0 0 0 1 0 1 0 = + X = X Transform the state space description into the Jordan canonical form and the transformation can be executed by the following statements. A=[ 0 1 0;0 0 1;2 3 0]; b=[0 0 1]'; c=[1 0 1]; d=0; [V,J]=jordan (A); [Ap,Bp,Cp,Dp]=ss2ss(A,b,c,d,inv(V)) or [Aj,Bj,Cj,Dj]=canon(A,b,c,d,’modal’) %不推荐使用 1.5 Consider a LTI system described by the following state space description 0 1 0 1 ( ) ( ) ( ), (0) 2 3 1 2 ( ) [1 2] ( ) X t X t u t X y t X t = + = − − = 1.5.1 Determine the matrix exponiential function t e A . The matrix exponiential function can be derived by the following statements: A=[0 1;-2 -3]; syms t eAt=expm(A*t) 1.5.2 Find the zero input response of the system in the period [0, 6s] It can be calculated by the following statements. %Zero input response A=[0,1;-2 -3]; B=[0;1];C=[1,2];D=[0];X0=[1;2];
sys=ss(A,B,C,D):t=[0:0.02:6];[y1,t,x1]=initial(sys,X0,t);figure(1)%绘制零输入响应曲线(包括状态(变量)和输出)subplot(1,2,1); plot(t,x1)subplot(1,2,2); plot(t,y1)1.5.3 When u(t)=1 (t), calculated the response ofthe system in the period [0, 6s]%The unit step response with zero initial stateA=[0,1;-2 -3]; B=[0;1];C=[1,2];D=[0];sys=ss(A,B,C,D);[y2,t,x2]=step(sys,t);figure(2)%绘制零状态响应曲线(包括状态(变量)和输出)subplot(1,2,1); plot(t,x2)subplot(1,2,2); plot(t,y2)%full response:x=x1+x2,y=y1+y2;figure(3)%绘制全响应曲线(包括状态(变量)和输出)subplot(1,2,1); plot(t,x)subplot(1,2,2); plot(t,y)Ill.Requirements ofthe report1.Write the relevant programs in the experimental content and compile them in thecomputer.2.All programs, results and related graphics are written on the experiment reporttogether.4
4 sys=ss(A,B,C,D); t=[0:0.02:6]; [y1,t,x1]=initial(sys,X0,t); figure(1) %绘制零输入响应曲线(包括状态(变量)和输出) subplot(1,2,1); plot(t,x1) subplot(1,2,2); plot(t,y1) 1.5.3 When u(t) = 1 (t), calculated the response of the system in the period [0, 6s] %The unit step response with zero initial state: A=[0,1;-2 -3]; B=[0;1];C=[1,2];D=[0]; sys=ss(A,B,C,D); [y2,t,x2]=step(sys,t); figure(2) %绘制零状态响应曲线(包括状态(变量)和输出) subplot(1,2,1); plot(t,x2) subplot(1,2,2); plot(t,y2) %full response: x=x1+x2; y=y1+y2; figure(3) %绘制全响应曲线(包括状态(变量)和输出) subplot(1,2,1); plot(t,x) subplot(1,2,2); plot(t,y) III. Requirements of the report 1.Write the relevant programs in the experimental content and compile them in the computer. 2.All programs, results and related graphics are written on the experiment report together