资源描述
1.控制系统模型 3
例8_1 3
例8_2 4
例8_3 6
例8_4 9
例8_5 10
例8_6 11
例8_7 12
2.控制系统的时域分析 14
例8_8 14
例8_9 15
例8_10 16
例8_11 17
例8_12 18
例8_13 20
例8_14 21
例8_15 23
3.控制系统的根轨迹 24
例8_16 24
例8_17 25
例8_18 26
例8_19 27
4.控制系统的频域分析 29
例8_20 29
例8_21 31
例8_22 32
例8_23 34
例8_24 35
例8_25 36
例8_26 37
例8_27 39
例8_28 40
例8_29 42
例8_30 44
例8_31 45
例8_32 47
例8_33 49
例8_34 51
例8_35 52
例8_36 53
例8_37 54
例8_38 55
例8_39 56
例8_40 58
例8_41 59
例8_42 60
6.最优控制器设计 62
例8_43 62
例8_44 63
例8_45 64
例8_46 65
例8_47 67
例8_48 69
例8_49 71
例8_50 73
例8_51 74
例8_52 76
1.控制系统模型
例8_1
设系统的零极点增益模型为:
求系统的传递函数及状态空间模型。
解:
k=6;
z=[-3];
p=[-1,-2,-5];
[num,den]=zp2tf(z,p,k);
[a,b,c,d]=zp2ss(z,p,k);
printsys(num,den);
printsys(a,b,c,d);
num/den =
6 s + 18
-----------------------
s^3 + 8 s^2 + 17 s + 10
a =
x1 x2 x3
x1 -1.00000 0 0
x2 2.00000 -7.00000 -3.16228
x3 0 3.16228 0
b =
u1
x1 1.00000
x2 1.00000
x3 0
c =
x1 x2 x3
y1 0 0 1.89737
d =
u1
y1 0
例8_2
给定离散系统的状态空间方程,
求传递函数模型和零极点模型,并判断其稳定性。
解:
a=[-2.8 -1.4 0 0;
1.4 0 0 0;
-1.8 -0.3 -1.4 -0.6;
0 0 0.6 0;];
b=[1;0; 1; 0];
c=[0 0 0 1];
d=[0];
[num,den]=ss2tf(a,b,c,d);
[z,p,k]=ss2zp(a,b,c,d)
pzmap(p,z);
title('Pole-Zero Map');
z =
-0.5000 + 1.1358i
-0.5000 - 1.1358i
p =
-1.4000 + 0.0000i
-1.4000 - 0.0000i
-1.0606
-0.3394
k =
0. 6000
回目录
回目录
例8_3
已知两个系统
求按串联、并联、单位负反馈、单位正反馈连接时的系统状态方程。
解:
a1=[0,1;-1,-2];
b1=[0;1];
c1=[1,3];
d1=[1];
a2=[0,1;-1,-3];
b2=[0;1];
c2=[1,4];
d2=[0];
sys1=ss(a1,b1,c1,d1);
sys2=ss(a2,b2,c2,d2);
title='Series state space matrix'
sys=series(sys2,sys1)
title='parallel state space matrix'
[a,b,c,d]=parallel(a1,b1,c1,d1,a2,b2,c2,d2)
title='Negative Feedback state space matrix'
[a,b,c,d]=feedback(a1,b1,c1,d1,a2,b2,c2,d2)
title='positive Feedback state space matrix'
[a,b,c,d]=feedback(a1,b1,c1,d1,a2,b2,c2,d2,+1)
title =
Series state space matrix
a =
x1 x2 x3 x4
x1 0 1 0 0
x2 -1 -2 1 4
x3 0 0 0 1
x4 0 0 -1 -3
b =
u1
x1 0
x2 0
x3 0
x4 1
c =
x1 x2 x3 x4
y1 1 3 1 4
d =
u1
y1 0
Continuous-time model.
title =
parallel state space matrix
a =
0 1 0 0
-1 -2 0 0
0 0 0 1
0 0 -1 -3
b =
0
1
0
1
c =
1 3 1 4
d =
1
title =
Negative Feedback state space matrix
a =
0 1 0 0
-1 -2 -1 -4
0 0 0 1
1 3 -2 -7
b =
0
1
0
1
c =
1 3 -1 -4
d =
1
title =
positive Feedback state space matrix
a =
0 1 0 0
-1 -2 1 4
0 0 0 1
1 3 0 1
b =
0
1
0
1
c =
1 3 1 4
d =
1
回目录
例8_4
时不变系统
判别系统的能控性和能观性。
解:
a=[-3,1;1,-3];
b=[1,1;1,1];
c=[1,1;1,-1];
cam=ctrb(a,b);
rcam=rank(cam)
oam=obsv(a,c);
roam=rank(oam)
rcam =
1
roam =
2
回目录
例8_5
线性系统
当分别取-1,0,+1 时,判别系统的可控性和可观性,并求出相应的状态方程。
解:
for alph=[-1:1];
alph
num=[1,alph];
den=[1 10 27 18];
[a b c d]=tf2ss(num,den);
cam=ctrb(a,b);
rcam=rank(cam)
oam=obsv(a,c);
coam=rank(oam)
end;
alph =
-1
rcam =
3
coam =
3
alph =
0
rcam =
3
coam =
3
alph =
1
rcam =
3
coam =
2
回目录
例8_6
利用Lyapunov方程确定线性时不变系统
的稳定性。
解:
令q=I,求解Lyapunov方程
然后确定p的正定性来证实系统的稳定性。
a=[-1,-2;1,-4];
q=[1,0;0,1];
p=lyap(a,q);
detp=det(p)
detp =
0.0567
回目录
例8_7
对连续模型
采用MATLAB提供的各种函数进行离散化处理,得到稍有差异的状态方程。
解:
disp('Contunue system');
k=6;
z=[-3];
p=[-1,-2,-5];
[a,b,c,d]=zp2ss(z,p,k);
%discrete system
t=0.1;
disp('Discrete system --using c2d');
[a1,b1]=c2d(a,b,t)
disp('Discrete system--using c2dm with zoh');
[a2,b2,c2,d2]=c2dm(a,b,c,d,t,'zoh')
disp('Discrete system--using c2dm with foh');
[a3,b3,c3,d3]=c2dm(a,b,c,d,t,'foh')
disp('Discrete system--using c2dm with Tustin');
[a4,b4,c4,d4]=c2dm(a,b,c,d,t,'tustin')
Contunue system
Discrete system --using c2d
a1 =
0.9048 0 0
0.1338 0.4651 -0.2237
0.0243 0.2237 0.9602
b1 =
0.0952
0.0784
0.0135
Discrete system--using c2dm with zoh
a2 =
0.9048 0 0
0.1338 0.4651 -0.2237
0.0243 0.2237 0.9602
b2 =
0.0952
0.0784
0.0135
c2 =
0 0 1.8974
d2 =
0
Discrete system--using c2dm with foh
a3 =
0.9048 0 0
0.1338 0.4651 -0.2237
0.0243 0.2237 0.9602
b3 =
0.0906
0.0611
0.0240
c3 =
0 0 1.8974
d3 =
0.0089
Discrete system--using c2dm with Tustin
a4 =
0.9048 0 0
0.1385 0.4545 -0.2300
0.0219 0.2300 0.9636
b4 =
0.9524
0.7965
0.1259
c4 =
0.0021 0.0218 0.1863
d4 =
0.0119
回目录
2.控制系统的时域分析
例8_8
典型二阶系统
其中为自然频率(无阻尼振荡频率),为相对阻尼系数。试绘制出,分别为0.1,0.2,…,1.2,2.0时的单位阶跃响应。
解:
wn=6;
kosi=[0.1:0.1:1.0,2.0];
figure(1);
hold on;
for kos=kosi
num=wn.^2;
den=[1,2*kos*wn,wn.^2];
step(num,den)
end;
%title('Step response');
hold off;
回目录
例8_9
对典型二阶系统
绘制出当,取2,4,6,8,10,12时的单位阶跃响应。
w=[2:2:12];
kos=0.7;
figure(1);
hold on;
for wn=w
num=wn.^2;
den=[1,2*kos*wn,wn.^2];
step(num,den)
end;
%title('Step response');
hold off;
回目录
例8_10
求三阶系统
的单位阶跃响应。
解:
num=[5 25 30];
den=[1 6 10 8];
figure
step(num,den);
title('Step response');
hold off;
回目录
例8_11
求典型二阶系统
当,时的单位冲激响应。
解:
wn=6;
kos=0.7;
figure(1);
num=wn.^2;
den=[1,2*kos*wn,wn.^2];
figure
impulse(num,den)
title('Impulse response');
回目录
例8_12
有高阶系统
求单位阶跃响应,单位冲激响应激零输入响应(设初始状态)
解:
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=[0,0,0,1;0,2,0,2];
d=zeros(2,2);
figure;
subplot(2,2,1);
step(a,b,c,d);
axis([0,6,-0.5,2.5]);
%title('Step Response');
subplot(2,2,2);
impulse(a,b,c,d);
%title('Impulse response');
subplot(2,2,3);
%axis([0,6,-0.5,2.5]);
x0=[1;1;1;-1];
initial(a,b,c,d,x0);
%title('Intial response');
subplot(2,2,4);
pzmap(a,b,c,d);
%title('Pole-Zero Map') ;
回目录
例8_13
多输入多输出系统
求单位阶跃响应和单位冲激响应。
解:
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=[0,0,0,1;0,2,0,2];
d=zeros(2,2);
figure(1);
step(a,b,c,d);
figure(2);
impulse(a,b,c,d);
回目录
例8_14
连续系统
以t=0.5s采样周期,采用双线性变换算法转换为离散系统,然后求出离散系统的单位阶跃响应、单位冲激响应及零输入响应(设初始状态)。
解:
a1=[-1.6,-0.9,0,0;0.9,0,0,0;
0.4,0.5,-5.0,-2.45;0,0,2.45,0];
b1=[1;0;1;0];
c1=[1,1,1,1];
d1=[0];
t=0.5;
[a,b,c,d]=c2dm(a1,b1,c1,d1,t,'tustin');
figure(1);
subplot(2,2,1);
dstep(a,b,c,d);
subplot(2,2,2);
dimpulse(a,b,c,d);
subplot(2,2,3);
x0=[1;1;1;-1];
dinitial(a,b,c,d,x0);
axis([0 6 0.5 2.5]);
subplot(2,2,4);
[z,p,k]=ss2zp(a,b,c,d,1);
zplane(z,p);
回目录
例8_15
离散二阶系统
求当输入幅值为±1的方波信号时系统的输出响应。
解:
num=0.632;
den=[1 ,-1.368,0.568];
u1=[ones(1,50),-1*ones(1,50)];
u=[u1,u1,u1];
figure(1);
dlsim(num,den,u);
%title('Discrete System Simulation');
回目录
3.控制系统的根轨迹
例8_16
设开环系统
绘制出通过单位负反馈构成的闭环系统的根轨迹。
解:
num=[3 1];
den=[2 1 0];
rlocus(num,den);
title('Root locus');
回目录
例8_17
设开环系统
绘制出闭环系统的根轨迹,并确定交点处的增益k。
解:
num=[1 5];
den=[1 5 6 0];
rlocus(num,den);
%title('Root locus');
[k,p]=rlocfind(num,den)
gtext('k=0.5');
回目录
例8_18
已知开环系统传递函数
绘制出闭环系统的根轨迹。
解:
num=[1];
den=[1 16 36 80 0];
rlocus(num,den);
%title('Root locus');
回目录
例8_19
已知开环系统传递函数
解:
num=[1 2];
den1=[1 4 3];
den=conv(den1,den1);
figure(1);
rlocus(num,den);
%title('Root locus');
[k,p]=rlocfind(num,den)
%Checking the stability
k=55;
figure(2);
num1=k*[1 2];
den=[1 4 3];
den1=conv(den,den);
[num,den]=cloop(num1,den1,-1);
impulse(num,den);
%title('Impulse Response (k=55)');
%Checking the stability
figure(3);
k=k+1;
k=56;
num1=k*[1 2];
den=[1 4 3];
den1=conv(den,den);
[num,den]=cloop(num1,den1,-1);
impulse(num,den);
%title('Impulse Response (k=56)');
Error in ==> D:\MATLABR11\toolbox\control\rlocfind.m
On line 58 ==> [k,poles] = rlocfind(tf(a,b),varargin{:});
回目录
4.控制系统的频域分析
例8_20
典型二阶系统
绘制出取不同值时的Bode图。
wn=6;
kosi=[0.1:0.1:1.0];
w=logspace(-1,1,100);
figure(1);
num=[wn.^2];
for kos=kosi
den=[1 2*kos*wn wn.^2];
[mag,pha,w1]=bode(num,den,w);
subplot(2,1,1);
hold on;
semilogx(w1,mag);
subplot(2,1,2);
hold on;
semilogx(w1,pha);
end;
subplot(2,1,1);
grid on;
xlabel('Frequency (rad/sec)');
ylabel('Gain dB');
subplot(2,1,2);
grid on;
xlabel('Frequency (rad/sec)');
ylabel('Phase deg');
hold off;
回目录
例8_21
有系统
绘制出系统的Bode图。
k=100;
z=[-4];
p=[0 -0.5 -50 -50];
[num,den]=zp2tf(z,p,k);
%subplot(2,1,1);
grid on;
%subplot(2,1,2);
%grid on;
bode(num,den);
title('Bode plot');
回目录
例8_22
系统传递函数模型为
求出有理传递函数的频率响应,然后在同一张图上绘出以四阶pade近似表示的系统频率响应。
num=[1 1];
den=conv([1 2],conv([1,2],[1,2]));
w=logspace(-1,2);
t=0.5;
[m1,p1]=bode(num,den,w);
p1=p1-t*w'*180/pi;
[n2,d2]=pade(t,4);
numt=conv(n2,num);
dent=conv(den,d2);
[m2,p2]=bode(numt,dent,w);
subplot(2,1,1);
semilogx(w,20*log10(m1),w,20*log10(m2),'r--');
subplot(2,1,2);
semilogx(w,p1,w,p2,'r--');
subplot(2,1,1);
grid on;
title('Bode plot');
xlabel('Frequency (rad/sec)');
ylabel('Gain dB');
subplot(2,1,2);
grid on;
xlabel('Frequency (rad/sec)');
ylabel('Phase deg');
回目录
例8_23
离散二阶系统
求系统的离散Bode图
num=0.632;
den=[1 ,-1.368,0.568];
grid on;
dbode(num,den,0.1);
title('Discrete Bode Plot');
回目录例8_24
开环系统
绘制出系统的Nyquist曲线,并判别系统的稳定性,最后求出闭环系统的单位冲激响应。
k=50;
z=[];
p=[-1,-5,2];
[num,den]=zp2tf(z,p,k);
figure(1);
nyquist(num,den);
title('Nyquist Plot');
figure(2);
[num1,den1]=cloop(num,den);
impulse(num1,den1);
title('Impulse Response');
回目录
例8_25
开环系统
绘制出系统的Nyquist曲线,并判别系统的稳定性,最后求出闭环系统的单位冲激响应。
k=50;
z=[];
p=[-1,-5,2];
[num,den]=zp2tf(z,p,k);
figure(1);
nyquist(num,den);
title('Nyquist Plot');
figure(2);
[num1,den1]=cloop(num,den);
impulse(num1,den1);
title('Impulse Response');
回目录例8_26
线性系统状态空间模型
绘制出系统的Bode图和Nyquist曲线,判断系统的稳定性,并绘制闭环系统的单位冲激响应进行验证。
a=[0,1,0,0;0,0,1,0;0,0,0,1;-62.5,-213.8,-204.2,-54];
b=[0,0,0,1]';
c=[1562,1875,0,0];
d=0;
w=logspace(-1,1);
figure(1);
bode(a,b,c,d,1,w);
title('Bode Plot');
figure(2);
nyquist(a,b,c,d,1,w);
title('Nyquist plot');
[z,p,k]=ss2zp(a,b,c,d);
p
figure(3);
[a1,b1,c1,d1]=cloop(a,b,c,d);
impulse(a1,b1,c1,d1);
title('Impulse Response');
p =
-50.0011
-2.4969
-1.0027
-0.4992
回目录例8_27
离散系统
绘制出系统的Nyquist曲线,判别闭环系统的稳定性,并绘制出闭环系统的单位冲激响应。
num=0.632;
den=[1 ,-1.368,0.568];
[z,p,k]=tf2zp(num,den);
p
dnyquist(num,den,0.1);
title('Discrete Nyquist Plot');
figure(2)
[num1,den1]=cloop(num,den);
dimpulse(num1,den1);
title('Discrete Impulse Response');
p =
0.6840 + 0.3165i
0.6840 - 0.3165i
回目录例8_28
一多环系统,
其结构如图,试用Nyquist曲线判断系统的稳定性。
k1=16.7/0.0125;
z1=[0];
p1=[-1.25 -4 -16];
[num1,den1]=zp2tf(z1,p1,k1);
[num,den]=cloop(num1,den1);
[z,p,k]=tf2zp(num,den);
p
figure(1);
nyquist(num,den);
title('Nyquist Plot');
figure(2)
[num2,den2]=cloop(num,den);
impulse(num2,den2);
title('Impulse Response');
p =
-10.5969 +36.2148i
-10.5969 -36.2148i
-0.0562
回目录例8_29
非线性系统
其中
,
当的(1/2,2/3)或[1,2]时,判断非线性系统的绝对稳定性。
a=[-2.1,-1.87,-0.203,0.894;1,0,0,0;0,1,0,0;0,0,1,0];
b=[1,0,0,0]';
c=[0,0,-1,-2];
d=0;
[num,den]=ss2tf(a,b,c,d);
num=-1*num;
[z,p,k]=tf2ss(num,den);
p
figure(1);
nyquist(num,den);
title('Nyquist Plot');
p =
1
0
0
0
回目录4. 极点配置和观测器设计
例8_30
系统开环传递函数为
绘制出Nickols图。
k1=16.7/0.0125;
z1=[0];
p1=[-1.25 -4 -16];
[num,den]=zp2tf(z1,p1,k1);
figure(1);
nichols(num,den);
axis([-360,0,-40,40]);
ngrid('New');
title('Nickols Plot');
回目录例8_31
被控对象
设计反馈控制器u=-kx,使闭环系统的极点为,,。
%Pole Placement--using transformation matrix
%
disp('Pole placement--using transformation matrix');
a=[0,1,0;0,0,1;-6,-11,-6];
b=[0;0;10];
%Step1
cam=ctrb(a,b);
disp('The rank of controllability matrix');
rc=rank(cam);
%Step2
beta=poly(a);
%Step3
a1=beta(2);
a2=beta(3);
a3=beta(4);
w=[a2,a1,1;a1,1,0;1,0,0];
t=cam*w;
%Step4
j=[-2+2*sqrt(3)*i, 0, 0;
0,-2-2*sqrt(3)*i,0;
0,0,-10];
alph=poly(j);
aa1=alph(2);
aa2=alph(3);
aa3=alph(4);
%Step 5
k=[aa3-a3,aa2-a2,aa1-a1]*(inv(t))
%
%Pole Placement ---using Ackermann's formula
%
disp('Pole Placement ---using Ackermann''s formula');
a=[0,1,0;0,0,1;-6,-11,-6];
b=[0;0;10];
%Step1
cam=ctrb(a,b);
disp('The rank of controllability matrix');
rc=rank(cam);
%Step2
j=[-2+2*sqrt(3)*i, 0, 0;
0,-2-2*sqrt(3)*i,0;
0,0,-10];
alph=poly(j);
%Step3
phi=polyvalm(alph,a);
%step 4
k=[0,0,1]*(inv(cam))*phi
%
%Pole Placement --using place function in Matlab
%
disp('Pole Placement --using place function in Matlab');
p=[-2+2*sqrt(3)*i,-2-2*sqrt(3)*i,-10];
k=place(a,b,p)
Pole placement--using transformation matrix
The rank of controllability matrix
k =
15.4000 4.5000 0.8000
Pole Placement ---using Ackermann's formula
The rank of controllability matrix
k =
15.4000 4.5000 0.8000
Pole Placement --using place function in Matlab
k =
15.4000 4.5000 0.8000
回目录
例8_32
含积分环节的类型1伺服系统,设对象为
设计控制器u=-kx+k1r,使闭环系统具有极点,-10。
%Pole Placement--using transformation matrix
%
disp('Pole placement--using transformation matrix');
disp('Pole Placement --using place function in Matlab');
a=[0,1,0;0,0,1;0,-2,-3];
b=[0;0;1];
c=[1 0 0];
d=[0];
disp('The rank of controllability matrix');
rc=ra
展开阅读全文