实验八线性系统的状态空间分析
§8.1 用MATLAB分析状态空间模型
1、状态空间模型的输入
线性定常系统状态空间模型
x?Ax?Bu
y?Cx?Du将各系数矩阵按常规矩阵形式描述。
A??a11B??b0C??c0D?d;a12b1c1a1nbn?cn?;;an1an2ann?
在MATLAB里,用函数SS()来建立状态空间模型
sys?ss(A,B,C,D)
例8.1 已知某系统微分方程
d2ydy?3?7y?5u dt2dt求该系统的状态空间模型。
解:将上述微分方程写成状态空间形式
?01??0?, A??B??????7?3??1?C??50?,D?0
调用MATLAB函数SS(),执行如下程序 % MATLAB Program example 6.1.m
A=[0 1;-7 -3]; B=[0;1]; C=[5 0]; D=0;
sys=ss(A,B,C,D)
运行后得到如下结果
a =
x1 x2 x1 0 1
x2 -7 -3 b =
u1 x1 0 x2 1
c =
x1 x2 y1 5 0
d =
u1 y1 0
Continuous-time model.
2、状态空间模型与传递函数模型转换
状态空间模型用sys表示,传递函数模型用G表示。
G=tf(sys) sys=ss(G)
状态空间表达式向传递函数形式的转换
G=tf(sys)
Or [num,den]=ss2tf(A,B,C,D) 多项式模型参数
[num,den]=ss2tf(A,B,C,D,iu)
[z,p,k]=ss2zp(A,B,C,D,iu) 零、极点模型参数
iu用于指定变换所需的输入量,iu默认为单输入情况。 传递函数向状态空间表达式形式的转换 sys=ss(G)
or [A,B,C,D]=tf2ss(num,den) [A,B,C,D]=zp2ss(z,p,k) 例 8.2
?x1???0.560.05??x1??0.031.14??u1????x????0.25?????0??x2??0.110???u2??2??
yx10?1????1???y??01??x???2??2??试用矩阵组[a,b,c,d]表示系统,并求出传递函数。
% MATLAB Program example 6.2.m a=[-0.56 0.05;-0.25 0]; b=[0.03 1.14;0.11 0]; c=[1 0;0 1]; d=zeros(2,2); sys=ss(a,b,c,d) G1=tf(sys) G2=zpk(sys)
运行后得到如下结果 a =
x1 x2 x1 -0.56 0.05 x2 -0.25 0 b =
u1 u2 x1 0.03 1.14 x2 0.11 0 c =
x1 x2 y1 1 0 y2 0 1 d =
u1 u2 y1 0 0 y2 0 0
Continuous-time model.
Transfer function from input 1 to output... 0.03 s + 0.0055 #1: --------------------- s^2 + 0.56 s + 0.0125
0.11 s + 0.0541 #2: --------------------- s^2 + 0.56 s + 0.0125
Transfer function from input 2 to output... 1.14 s #1: --------------------- s^2 + 0.56 s + 0.0125
-0.285 #2: --------------------- s^2 + 0.56 s + 0.0125
Zero/pole/gain from input 1 to output... 0.03 (s+0.1833) #1: ----------------------
(s+0.5367) (s+0.02329)
0.11 (s+0.4918) #2: ----------------------
(s+0.5367) (s+0.02329)
Zero/pole/gain from input 2 to output... 1.14 s #1: ----------------------
(s+0.5367) (s+0.02329)
-0.285 #2: ----------------------
(s+0.5367) (s+0.02329)
例8.3 考虑下面给定的单变量系统传递函数
s3?7s2?24s?24G(s)?4
s?10s3?35s2?50s?24由下面的MATLAB语句直接获得状态空间模型。 >> num=[1 7 24 24]; >> den=[1 10 35 50 24]; >> G=tf(num,den); >> sys=ss(G)
运行后得到如下结果: a =
x1 x2 x3 x4 x1 -10 -4.375 -3.125 -1.5
x2 8 0 0 0 x3 0 2 0 0 x4 0 0 1 0
b =
u1 x1 2 x2 0 x3 0 x4 0 c =
x1 x2 x3 x4 y1 0.5 0.4375 0.75 0.75 d =
u1 y1 0
Continuous-time model.
3. 线性系统的非奇异变换与标准型状态空间表达式
syst=ss2ss(sys,T)
sys, syst分别为变换前、后系统的状态空间模型,T为非奇异变换阵。 [At,Bt,Ct,Dt]=ss2ss(A,B,C,D,T)
(A,B,C,D)、(At,Bt,Ct,Dt)分别为变换前、后系统的状态空间模型的系数矩阵。
§8.2 利用MATLAB求解系统的状态方程
线性定常连续系统状态方程
x?Ax?Bu,x(0)?x0,t?0
状态响应
x(t)??(t)x0???(t??)Bu(?)d?, t?0
0t式中状态转移矩阵?(t)?eAt,则有
x(t)?eAtx(0)??eA(t??)Bu(?)d?, t?0
0t1. 用MATLAB中expm(A)函数计算状态转移矩阵e 例8.4x??At?0?2??2??1?,,u?0 x?ux(0)???????1?3??0??1?Att?0.2①求当t?0.2时,状态转移矩阵即e;
实验八MATLAB状态空间分析



