
一.实验目的
1.通过搭建控制系统典型环节模型,熟悉并掌握自动控制仿真的方法。
2.通过对典型环节的软件仿真研究,熟悉并掌握Matlab软件的使用方法。
3.了解并掌握各典型环节的传递函数及其特性,观察和分析各典型环节的响应曲线,掌握电路模拟和软件仿真研究方法。
二.实验内容
1.搭建各种典型环节的模拟电路,观测并记录各种典型环节的阶跃响应曲线。
2.调节模拟电路参数,研究参数变化对典型环节阶跃响应的影响。
3.运行Matlab软件中的simulink仿真功能,完成各典型环节阶跃特性的软件仿真研究,并与理论计算的结果作比较。
三.实验步骤
1. 典型环节的simulink仿真分析
在实验中观测实验结果时,只要运行Matlab,利用Matlab软件中的simulink仿真功能,以及Matlab编程功能,可以完成常见的控制系统典型环节动态响应。
1.)比例环节:
仿真过程及其结果如下:
2.)惯性环节:
仿真过程及其仿真结果如下:
3.)积分环节:
仿真过程及其结果:
4.微分环节:
仿真过程及其结果:
2. 典型控制系统Matlab仿真分析
(1).验证Laplace变换表:
1)
syms s t w a b
F1=1/s;
f1=ilaplace(F1);
f1=simple(f1)
f1 =1
2)
syms s t w a b
F1=1/s^2;
f1=ilaplace(F1);
f1=simple(f1)
f1 =t
3)
syms s t w a b
F1=1/(s+a);
f1=ilaplace(F1);
f1=simple(f1)
f1 =exp(-a*t)
4)
syms s t w a b
F1=1/(s^2+w^2);
f1=ilaplace(F1);
f1=simple(f1)
f1 =sin((w^2)^(1/2)*t)/w
5)
syms s t w a b
F1=s/(s^2+w^2);
f1=ilaplace(F1);
f1=simple(f1)
f1 =cos(csgn(w)*w*t)
6)
syms s t w a b
F1=s/(s+a)/(s+b);
f1=ilaplace(F1);
f1=simple(f1)
f1 =1/(b-a)*(b*exp(-b*t)-a*exp(-a*t))
7)
syms s t w a b
F1=1/(s+a)^2/s;
f1=ilaplace(F1);
f1=simple(f1)
f1 =1/a^2*(1-(1+a*t)*exp(-a*t))
8)
syms s t w a b n
F1=1/(s+a)^n;
f1=ilaplace(F1);
f1=simple(f1)
f1 =ilaplace((s+a)^(-n),s,t)
syms s t w a b n
F1=1/(s+a)^5;
f1=ilaplace(F1);
f1=simple(f1)
f1 =1/24*t^4/exp(a*t)
9)
syms s t w a b n
F1=(s+b)/(s+a)/(s^2+w^2);
f1=ilaplace(F1);
f1=simple(f1)
f1 =
(exp(-a*t)*b*w-exp(-a*t)*a*w-b*cos(w*t)*w+a*cos(w*t)*w+w^2*sin(w*t)+a*b*sin(w*t))/(w^3+w*a^2)
10)
syms s t w a b n
F1=(s+a)/((s+b)^2+w^2);
f1=ilaplace(F1);
f1=simple(f1)
f1 =exp(-b*t)*(cos(w*t)*w-b*sin(w*t)+a*sin(w*t))/w
1)p34 例2~5
syms s
ilaplace((s+2)/(s^2+4*s+3))
ezplot(ilaplace((s+2)/(s^2+4*s+3)),[0 5]);
grid;
set(gca,'ytick',0:.05:1.2);
2.) 例2~6
syms s
f1=ilaplace((s-3)/(s^2+2*s+2))
ezplot(ilaplace((s-3)/(s^2+2*s+2)),[0 10]);
grid;
set(gca,'ytick',0:.05:1.2);
3.).p34 例2~7
syms s
ezplot(ilaplace((s+2)/(s^2+2*s+1)/(s^2+3*s)),[0 20]);
grid;
set(gca,'ytick',0:.05:1.2);
4)P76 例2~26
G1=tf([1],[1 10]);
G2=tf([1],[1 1]);
G3=tf([1 0 1],[1 4 4]);
numg4=[1 1];
deng4=[1 6];
G4=tf(numg4,deng4);
H1=zpk([-1],[-2],1);
numh2=[2];denh2=[1];H3=1;
nh2=conv(numh2,deng4);dh2=conv(denh2,numg4);
H2=tf(nh2,dh2);
sys1=series(G3,G4);
sys2=feedback(sys1,H1,+1);
sys3=series(G2,sys2);
sys4=feedback(sys3,H2);
sys5=series(G1,sys4);
sys=feedback(sys5,H3)
Zero/pole/gain:
0.083333 (s+1)^2 (s+2) (s^2 + 1)
----------------------------------------------------------
(s+10.12) (s+2.44) (s+2.349) (s+1) (s^2 + 1.176s + 1.023)
脉冲响应:
syms s
ezplot(ilaplace(( 0.083333*(s+1)^2*(s+2)*(s^2+1))/(s+10.12)/(s+2.44)/(s+2.349)/(s+1)/(s^2 + 1.176*s + 1.023)),[0 20]);
grid;
单位阶跃响应:
syms s
ezplot(ilaplace(( 0.083333*(s+1)^2*(s+2)*(s^2+1))/s/(s+10.12)/(s+2.44)/(s+2.349)/(s+1)/(s^2 + 1.176*s + 1.023)),[0 20]);
grid;
set(gca,'ytick',0:.05:1.2);
5)P78,2~6
syms t s;
r=1*sym('Heaviside(t)');
c=1-exp(-2*t)+exp(-t);
R=laplace(r);
C=laplace(c);
G=simple(C/R);
[GN,GD]=numden(simple(C/R))
g=ilaplace(G)
GN =4*s+s^2+2
GD =(s+2)*(1+s)
g =Dirac(t)+2*exp(-2*t)-exp(-t)
所以系统的传递函数是:
G(s)= GN/ GD=(4*s+s^2+2)/(s+2)*(1+s)
6.P78,2~7
(1)微分方程拉普拉斯变换:
syms t s A B C D y x;
z0=A*diff(sym('y(t)'),2)+B*diff(sym('y(t)'))+C*sym('y(t)');
z=laplace(z0);
y=laplace(D*sym('Heaviside(t)'));
S=z-y
S =A*(s*(s*laplace(y(t),t,s)-y(0))-D(y)(0))+B*(s*laplace(y(t),t,s)-y(0))+C*laplace(y(t),t,s)-D/s
(2)微分方程的解:
syms t s Y X A B C D;
A=1;B=3;C=2;D=2;
S=A*s^2*Y+s+B*s*Y+B+C*Y-D/s;
F=solve(S,Y);
f0=ilaplace(F);
y=simple(factor(f0))
y =1+2/exp(t)^2-4/exp(t)
syms t
y =1+2/exp(t)^2-4/exp(t)
ezplot((y),[0,15])
7.P41,2~13
syms t s A B C D y x Y;
z0=A*diff(sym('y(t)'),2)+B*diff(sym('y(t)'))+C*sym('y(t)');
z=laplace(z0);
y=laplace(D*sym('Heaviside(t)'));
S=z-y
A=1;B=1;C=1;D=1;
S=A*s^2*Y+s+B*s*Y+B+C*Y-D/s;
F=solve(S,Y);
f0=ilaplace(F);
y=simple(factor(f0))
ezplot((y),[0,15])
S =A*(s*(s*laplace(y(t),t,s)-y(0))-D(y)(0))+B*(s*laplace(y(t),t,s)-y(0))+C*laplace(y(t),t,s)-D/s
y =1-2*exp(-1/2*t)*cos(1/2*3^(1/2)*t)-2/3*exp(-1/2*t)*3^(1/2)*sin(1/2*3^(1/2)*t)
或者也可以用Matllab直接求解:
syms t u;
u=dsolve('D2u+Du+u=1','u(0)=0.1,Du(0)=0.1','t')
ezplot(u,[0,10])
u=1-7/30*3^(1/2)*exp(-1/2*t)*sin(1/2*3^(1/2)*t)-9/10*exp(-1/2*t)*cos(1/2*3^(1/2)*t)
t=7/30*3^(1/2),t =0.4041
