《控制系统数字仿真与CAD第4章仿真题答案.doc》由会员分享,可在线阅读,更多相关《控制系统数字仿真与CAD第4章仿真题答案.doc(12页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、控制系统数字仿真与CAD第四章上机实验报告院系:电信工程学院 班级:11级控制工程基地1班 姓名: 张亚东 学号: 时间: 2014 年 5 月 27日例 4-1 求阶跃响应的数值解。解:先建立一个名为sp4-1.m的子程序如下:b=b/a(1);a=a/a(1);A=a(2:n+1);A=rot90(rot90(eye(n-1,n);-fliplr(A);B=zeros(1,n-1),1;m1=length(b);C=fliplr(b),zeros(1,n-m1);Ab=A-B*C*V;X=X0;y=0;t=T0;N=round(Tf-T0)/h;for i=1:NK1=Ab*X+B*R;K
2、2=Ab*(X+h*K1/2)+B*R;K3=Ab*(X+h*K2/2)+B*R;K4=Ab*(X+h*K3)+B*R;X=X+h*(K1+2*K2+2*K3+K4)/6;y=y,C*X;t=t,t(i)+h; end t,yplot(t,y)然后对上面的子程序进行调用,改变开环放大系数k,得到k取不同值时输出响应的曲线如下: k=2; a=conv(1 0 0,conv(0.25 1,0.25 1)a = 0.0625 0.5000 1.0000 0 0 b=2*k kb = 4 2 X0=0 0 0 0X0 = 0 0 0 0 V=1;n=4;T0=0;Tf=10;h=0.25;R=1;
3、sp4_1ans = 0 0 0.2500 0.0885 0.5000 0.5393 0.7500 1.1650 1.0000 1.6690 1.2500 1.8332 1.5000 1.6199 1.7500 1.1704 2.0000 0.7182 2.2500 0.4703 2.5000 0.5143 2.7500 0.7923 3.0000 1.1453 3.2500 1.3991 3.5000 1.4468 3.7500 1.2900 4.0000 1.0251 4.2500 0.7869 4.5000 0.6817 4.7500 0.7413 5.0000 0.9177 5.250
4、0 1.1143 5.5000 1.2373 5.7500 1.2382 6.0000 1.1310 6.2500 0.9782 6.5000 0.8558 6.7500 0.8165 7.0000 0.8683 7.2500 0.9760 7.5000 1.0828 7.7500 1.1391 8.0000 1.1250 8.2500 1.0554 8.5000 0.9691 8.7500 0.9081 9.0000 0.8975 9.2500 0.9360 9.5000 0.9999 9.7500 1.0563 10.0000 1.0801 hold on k=1; a=conv(1 0
5、0,conv(0.25 1,0.25 1)a = 0.0625 0.5000 1.0000 0 0 b=2*k kb = 2 1 X0=0 0 0 0X0 = 0 0 0 0 V=1;n=4;T0=0;Tf=10;h=0.25;R=1; sp4_1ans = 0 0 0.2500 0.0443 0.5000 0.2779 0.7500 0.6392 1.0000 1.0237 1.2500 1.3410 1.5000 1.5361 1.7500 1.5944 2.0000 1.5342 2.2500 1.3950 2.5000 1.2235 2.7500 1.0619 3.0000 0.939
6、9 3.2500 0.8715 3.5000 0.8563 3.7500 0.8826 4.0000 0.9333 4.2500 0.9905 4.5000 1.0397 4.7500 1.0718 5.0000 1.0837 5.2500 1.0776 5.5000 1.0589 5.7500 1.0345 6.0000 1.0106 6.2500 0.9919 6.5000 0.9809 6.7500 0.9778 7.0000 0.9811 7.2500 0.9883 7.5000 0.9968 7.7500 1.0043 8.0000 1.0095 8.2500 1.0118 8.50
7、00 1.0113 8.7500 1.0088 9.0000 1.0053 9.2500 1.0018 9.5000 0.9990 9.7500 0.9972 10.0000 0.9966 hold on k=0.5; a=conv(1 0 0,conv(0.25 1,0.25 1)a = 0.0625 0.5000 1.0000 0 0 b=2*k kb = 1.0000 0.5000 X0=0 0 0 0X0 = 0 0 0 0 V=1;n=4;T0=0;Tf=10;h=0.25;R=1; sp4_1ans = 0 0 0.2500 0.0221 0.5000 0.1410 0.7500
8、0.3342 1.0000 0.5631 1.2500 0.7948 1.5000 1.0055 1.7500 1.1809 2.0000 1.3141 2.2500 1.4038 2.5000 1.4527 2.7500 1.4661 3.0000 1.4508 3.2500 1.4140 3.5000 1.3626 3.7500 1.3030 4.0000 1.2406 4.2500 1.1798 4.5000 1.1237 4.7500 1.0745 5.0000 1.0335 5.2500 1.0011 5.5000 0.9770 5.7500 0.9606 6.0000 0.9510
9、 6.2500 0.9470 6.5000 0.9474 6.7500 0.9510 7.0000 0.9569 7.2500 0.9640 7.5000 0.9716 7.7500 0.9791 8.0000 0.9860 8.2500 0.9920 8.5000 0.9970 8.7500 1.0010 9.0000 1.0038 9.2500 1.0058 9.5000 1.0068 9.7500 1.0072 10.0000 1.0070 hold on k=0.3; a=conv(1 0 0,conv(0.25 1,0.25 1)a = 0.0625 0.5000 1.0000 0
10、0 b=2*k kb = 0.6000 0.3000 X0=0 0 0 0X0 = 0 0 0 0 V=1;n=4;T0=0;Tf=10;h=0.25;R=1; sp4_1ans = 0 0 0.2500 0.0133 0.5000 0.0851 0.7500 0.2041 1.0000 0.3507 1.2500 0.5088 1.5000 0.6673 1.7500 0.8184 2.0000 0.9571 2.2500 1.0804 2.5000 1.1864 2.7500 1.2745 3.0000 1.3445 3.2500 1.3970 3.5000 1.4329 3.7500 1
11、.4534 4.0000 1.4602 4.2500 1.4547 4.5000 1.4389 4.7500 1.4143 5.0000 1.3828 5.2500 1.3461 5.5000 1.3057 5.7500 1.2632 6.0000 1.2199 6.2500 1.1768 6.5000 1.1352 6.7500 1.0957 7.0000 1.0592 7.2500 1.0260 7.5000 0.9965 7.7500 0.9711 8.0000 0.9498 8.2500 0.9325 8.5000 0.9191 8.7500 0.9096 9.0000 0.9035
12、9.2500 0.9006 9.5000 0.9005 9.7500 0.9029 10.0000 0.9073 hold on k=0.1; a=conv(1 0 0,conv(0.25 1,0.25 1)a = 0.0625 0.5000 1.0000 0 0 b=2*k kb = 0.2000 0.1000 X0=0 0 0 0X0 = 0 0 0 0 V=1;n=4;T0=0;Tf=10;h=0.25;R=1; sp4_1ans = 0 0 0.2500 0.0044 0.5000 0.0285 0.7500 0.0692 1.0000 0.1212 1.2500 0.1807 1.5
13、000 0.2452 1.7500 0.3131 2.0000 0.3834 2.2500 0.4553 2.5000 0.5281 2.7500 0.6013 3.0000 0.6742 3.2500 0.7465 3.5000 0.8177 3.7500 0.8873 4.0000 0.9549 4.2500 1.0202 4.5000 1.0828 4.7500 1.1424 5.0000 1.1986 5.2500 1.2514 5.5000 1.3004 5.7500 1.3454 6.0000 1.3864 6.2500 1.4232 6.5000 1.4557 6.7500 1.
14、4839 7.0000 1.5077 7.2500 1.5272 7.5000 1.5424 7.7500 1.5534 8.0000 1.5603 8.2500 1.5631 8.5000 1.5620 8.7500 1.5573 9.0000 1.5490 9.2500 1.5373 9.5000 1.5225 9.7500 1.5048 10.0000 1.4844蓝色细实线:k=2 黑色虚线:k=1 蓝色虚线:k=0.5 红色虚线:k=0.3 紫色虚线:k=0.1即:k增大使系统震荡加剧,k减小对系统快速性和稳定性都有改善。4-5. 解:P=1 0.01 1 0;0 0.085 1 0
15、.17;1 0.01 1 0;0 0.051 1 0.15;1 0.0067 70 0;1 0.15 0.21 0;0 1 130 0;1 0.01 0.1 0;1 0.01 0.0044 0;W=0 0 0 0 0 0 0 0 0;1 0 0 0 0 0 0 0 -1 ; 0 1 0 0 0 0 0 0 0 ; 0 0 1 0 0 0 0 -1 0;0 0 0 1 0 0 0 0 0 ;0 0 0 0 1 0 0 0 0 ;0 0 0 0 0 1 0 0 0 ;0 0 0 0 0 1 0 0 0 ;0 0 0 0 0 0 1 0 0 ;W0=1;0;0;0;0;0;0;0;0;WIJ=1 0
16、 1;2 1 1;2 9 -1;3 2 1;4 3 1 ;4 8 -1;5 4 1;6 5 1;6 10 -1;7 6 1 ;8 6 1 ;9 7 1;n=9;Y0=1;Yt0=0 0 0 0 0 0 0 0 0 ;h=0.01;L1=1;T0=0;Tf=10;nout=7;A=diag(P(:,1);B=diag(P(:,2);C=diag(P(:,3);D=diag(P(:,4); Q=B-D*W;Qn=inv(Q);R=C*W-A;V1=C*W0;Ab=Qn*R;b1=Qn*V1;Y=Yt0;y=Y(nout);t=T0;N=round(Tf-T0)/(h*L1);for i=1:N for j=1:L1; K1=Ab*Y+b1*Y0 K2=Ab*(Y+h*K1/2)+b1*Y0 K3=Ab*(Y+h*K2/2)+b1*Y0 K4=Ab*(Y+h*K3)+b1*Y0 Y=Y+h*(K1+2*K2+2*K3+K4)/6; end y=y,Y(nout); t=t,t(i)+h*L1;endplot(t,y)