您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > neu控制系统仿真CAD作业
控制系统计算机辅助设计自动化1103人间惆怅客1控制系统计算机辅助设计第一部分1.M文件:functiondx=rossler(t,x)dx=[-x(2)-x(3);x(1)+0.2*x(2);0.2+(x(1)-5.7)*x(3)];指令:x0=[0;0;0];[t,y]=ode45('rossler',[0,100],x0);plot(t,y)020406080100-15-10-50510152025figureplot3(y(:,1),y(:,2),y(:,3)),grid控制系统计算机辅助设计自动化1103人间惆怅客2-10-5051015-15-10-5051005101520252.m文件function[c,ceq]=opt_con1(x)ceq=[];c=[4*x(1)*x(1)+x(2)*x(2)-4;-x(1);-x(2)];指令y=@(x)x(1)*x(1)-2*x(1)+2*x(2);x0=[0;0];xm=[0;0];xM=[];A=[];B=[];Aeq=[];Beq=[];[x,f_opt]=fmincon(y,x0,A,B,Aeq,Beq,xm,xM,@opt_con1)x=1.00000f_opt=-13.(a)控制系统计算机辅助设计自动化1103人间惆怅客3s=tf('s');G=(s^3+4*s+2)/(s^3*(s^2+2)*((s^2+1)^3+2*s+5))Transferfunction:s^3+4s+2------------------------------------------------------s^11+5s^9+9s^7+2s^6+12s^5+4s^4+12s^3(b)z=tf('z',0.1);H=(z^2+0.568)/(z-1)/(z^2-0.2*z+0.99)Transferfunction:z^2+0.568-----------------------------z^3-1.2z^2+1.19z-0.99Samplingtime:0.14.手工运算整理得令x1=y;x2=dx1/dt;x3=dx2/dt;dx3/dt=2*u-5*x1-4*x2-13*x3;A=[0,1,0;0,0,1;-5,-4,-13];即可得出状态方程:[dx1/dt;dx2/dt;dx3/dt]=A*[x1;x2;x3]+[0;0;2];将上述状态方程输入到MATLAB命令窗口;调用tf(G),zpk(G)指令即可得出传递函数和零极点模型A=[010;001;-5,-4,-13];B=[0;0;2];C=[100];D=0;G=ss(A,B,C,D)a=x1x2x3x1010x2001x3-5-4-13b=u1x10x20x32c=x1x2x3y1100d=u1y10Continuous-timemodel.tf(G)Transferfunction:2----------------------s^3+13s^2+4s+5控制系统计算机辅助设计自动化1103人间惆怅客4zpk(G)Zero/pole/gain:2----------------------------------(s+12.72)(s^2+0.2836s+0.3932)当然可以由微分方程直接得出传递函数;用拉普拉斯变换法可直接输入:G=tf(2,[11345])Transferfunction:2----------------------s^3+13s^2+4s+55.采用z变换方法;设采样周期为1sz=tf('z',1);G=(z+2)/(z^2+z+0.016)Transferfunction:z+2---------------z^2+z+0.016Samplingtime:16.symsGJGcKpKisG=(s+1)/(J*s^2+2*s+5);Gc=(Kp*s+Ki)/s;GG=feedback(G*Gc,1)GG=(s+1)*(Kp*s+Ki)/(J*s^3+2*s^2+5*s+Kp*s^2+s*Ki+Kp*s+Ki)7.(a)G=tf([211.87,317.64],conv(conv([1,20],[1,94.34]),[1,0.1684]));Gc=tf([169.6,400],[1,4,0]);H=tf(1,[0.01,1]);GG=feedback(G*Gc,H)Transferfunction:359.3s^3+3.732e004s^2+1.399e005s+127056----------------------------------------------------------------------------------0.01s^6+2.185s^5+142.1s^4+2444s^3+4.389e004s^2+1.399e005s+127056zpk(GG)Zero/pole/gain:35933.152(s+100)(s+2.358)(s+1.499)--------------------------------------------------------------------------控制系统计算机辅助设计自动化1103人间惆怅客50.02(s^2+3.667s+3.501)(s^2+11.73s+339.1)(s^2+203.1s+1.07e004)(b)z=tf('z',1);G=(35786.7*z^-1+108444)/(z^-1+4)/(z^-1+20)/(z^-1+74.04);Gc=1/(z^-1-1);H=1/(0.5*z^-1-1);GG=feedback(G*Gc,H)Transferfunction:-108444z^6+1.844e004z^5+1.789e004z^4-------------------------------------------------------------------------1.144e005z^6+2.876e004z^5+274.2z^4+782.4z^3+47.52z^2+0.5zSamplingtime:1zpk(GG)Zero/pole/gain:-0.94821z^4(z-0.5)(z+0.33)-------------------------------------------------------------z(z+0.3035)(z+0.04438)(z+0.01355)(z^2-0.11z+0.02396)Samplingtime:18.g1=tf(1,[1,1]);gc1=tf([1,0],[1,0,2]);h1=tf([4,2],[1,2,1]);G=feedback(g1*gc1,h1)Transferfunction:s^3+2s^2+s--------------------------------------s^5+3s^4+5s^3+11s^2+8s+2g2=tf(1,[1,0,0]);h2=50;Gc=feedback(g2,h2)Transferfunction:1--------s^2+50H=tf([1,0,2],[1,0,0,14]);GG=3*feedback(G*Gc,H)Transferfunction:3s^6+6s^5+3s^4+42s^3+84s^2+42s-----------------------------------------------------------------------------------------------------s^10+3s^9+55s^8+175s^7+300s^6+1323s^5+2656s^4+3715s^3+7732s^2+5602s+14009.num=conv(conv([1,1],[1,1]),[1,2,400]);den=conv(conv(conv([1,5],[1,5]),[1,3,100]),[1,3,2500]);G=tf(num,den);step(G)grid;holdon;G1=c2d(G,0.01);step(G1)控制系统计算机辅助设计自动化1103人间惆怅客6holdon;G2=c2d(G,0.1);step(G2)holdon;G3=c2d(G,1);step(G3)10.(a)G=tf(1,[1,2,1,2]);eig(G)ans=-2.00000.0000+1.0000i0.0000-1.0000i临界稳定(b)G=tf(1,[6,3,2,1,1]);eig(G)ans=-0.4949+0.4356i-0.4949-0.4356i0.2449+0.5688i0.2449-0.5688i不稳定(c)G=tf(1,[4,1,-3,-1,2]);eig(G)ans=-0.8057+0.4664i-0.8057-0.4664i0.6807+0.3372i0.6807-0.3372i不稳定11(a)z=tf('z',1);H=(-3*z+2)/(z^3-0.2*z^2-0.25*z+0.05);abs(eig(H))ans=0.50000.50000.2000稳定(b)z=tf('z',1);H=(3*z-0.39*z-0.09)/(z^4-1.7*z^3+1.04*z^2+0.268*z+0.024);abs(eig(H))ans=1.19391.19390.12980.1298不稳定12.A=[-0.2,0.5,0,0,0;0,-0.5,1.6,0,0;0,0,-14.3,85.8,0;0,0,0,-33.3,100;0,0,0,0,-10];B=[000030]';rank(ctrb(A,B))ans=5完全可控控制系统计算机辅助设计自动化1103人间惆怅客713显然,这个自治的微分方程组的解析解为x(t)=x(0)*expm(A*t)A=[-5200;0-400;-32-4-1;-320-4];x0=[1201]';symsst;x=expm(A*t)*x0x=-3*exp(-5*t)+4*exp(-4*t)2*exp(-4*t)18*exp(-4*t)-18*exp(-5*t)-18*t*exp(-4*t)+4*t^2*exp(-4*t)10*exp(-4*t)-9*exp(-5*t)-8*t*exp(-4*t)由于符号运算不能图解,将x分成四个表达式,用离散化的t向量为为自变量,绘图t=[0:0.02:2];x1=-3*exp(-5*t)+4*exp(-4*t);x2=2*exp(-4*t);x3=18*exp(-4*t)-18*exp(-5*t)-18*t.*exp(-4*t)+4*t.^2.*exp(-4*t);x4=10*exp(-4*t)-9*exp(-5*t)-8*t.*exp(-4*t);plot(t,x1,t,x2,t,x3,t,x4),grid00.511.52-0.500.511.52x0(1)x0(2)x0(3)x0(4)数值解法:f=@(t,x)[-5200;0-400;-32-4-1;-320-4]*x;[t,y]=ode45(f,[0,2],[1201]');plot(t,y)控制系统计算机辅助设计自动化1103人间惆怅客800.511.52-0.500.511.52x0(1)x0(2)x0(3)x0(4)可见,数值解与解析解很接近。14.(a)G=tf(conv([1,6],[1,-6]),conv(conv(conv([1,0],[1,3]),[1,4-4*j]),[1,4+4*j]))rlocus(G)控制系统计算机辅助设计自动化1103人间惆怅客9RootLocusRealAxis
本文标题:neu控制系统仿真CAD作业
链接地址:https://www.777doc.com/doc-3316003 .html