MATLAB控制系统仿真

上传人:小** 文档编号:26957439 上传时间:2021-08-15 格式:DOC 页数:31 大小:1.21MB
返回 下载 相关 举报
MATLAB控制系统仿真_第1页
第1页 / 共31页
MATLAB控制系统仿真_第2页
第2页 / 共31页
MATLAB控制系统仿真_第3页
第3页 / 共31页
点击查看更多>>
资源描述
控制系统的模型与转换1.请将下面的传递函数模型输入到matlab 环境。G(s)T=0.1s3s +4s + 2=3223s (s - 2)( s 1) 2s 52z +0.568H (z)厂(z _1)( z _0.2z +0.99) s=tf(s);G=(sA3+4*s+2)/(sA3*(sA2+2)*(sA2+1)A3+2*s+5);GTransfer function:sA3 + 4 s + 2sA11 + 5 sA9 + 9 sA7 + 2 sA6 + 12 sA5 + 4 sA4 + 12 sA3 num=1 0 0.56;den=conv(1 -1,1 -0.2 0.99);H=tf(num,den,Ts,0.1)Transfer function:zA2 + 0.56zA3 - 1.2 zA2 + 1.19 z - 0.992.请将下面的零极点模型输入到8(s +1 + j)(s +1 j)G(s) 22s (s +5)( s +6)( s +1)matlab环境。请求出上述模型的零极点,并绘制其位置。H (z)(z 3.2)( z 2.6)z(z8.2)T=0.05sZ=-1-j -1+j;p=0 0 -5 -6 -j j;G=zpk(z,p,8)Zero/pole/gain:8 (sA2 + 2s + 2)Pcle-Zerq Mypi111 1ek0.8 - -10.80.6sA2 (s+5) (s+6) (sA2+ 1)pzmap(G)2o.4-O. z=0 0 0 0 0 -1/3.2 -1/2.6;P=1/8.2;H=zpk(z,p,1,Ts,0.05)D6-0.8-1Pole-Zero Map-1 卫田 -0 6-0 4 JO.200.20.40.S00Reai AxisZero/pole/gain:zA5 (z+0.3125) (z+0.3846)(z-0.122)Sampling time: 0.05pzmap (H)线性系统分析111. 请分析下面传递函数模型的稳定性。111G(S)2s2*2G(s)3s 12 2s (300 s 600 s 50) 3s 111 num=1; den=1 2 1 2; G=tf(num,den); eig(G)ans =-2.00000.0000 - 1.0000i0.0000 + 1.0000i可见,系统有两个特征根在虚轴上, 一个特征根在虚轴左侧,所以系统是临 界稳定的。 num=3 1;Pole-Zero Map.5o-DD5 o.5 o.-O启 SEE-den=300 600 50 3 1;1G=tf(num,den);eig(G)ans =-1.9152-0.14140.0283 - 0.1073i0.0283 + 0.1073i可见,有两个特征根在虚轴右侧,所以系统是不稳定的。2. 请判定下面离散系统的稳定性。3z 2W.25Z55)H (z)2.12z +11 .76 z 丄 +15 .91z 乂 -7.368 z 、一20.15 z - 102 .4z 80 .39 z一340 ) num=-3 2;den=1 -0.2 -0.25 0.05;H=tf(num,den,Ts,0.1);eig(H) abs(eig(H) ans =-0.50000.50000.50000.50000.2000 0.2000可以看出,由于各个特征根的模均 小于1,所以可以判定闭环系统是稳定 的。4Pote-Zero Mapiiii0.3-/J-0-6-ZX=I/I0.4f r1% J hf10.2Fi11a;V_ -0.21L-0.4fc BL*f Jhf-0.8 %h.尹*-0.3-、 :-: ”*-1 -1 f11J If M-1尸十八11-0.8-O.e4).44左00.20.40.6O.B1ft&al Axis z=tf(z,0.1);H=(2.12*zA-2+11.76*zA- 1+15.91)/(zA-5-7.368*zA-4-20.15*zA-3+102.4*zA-2+80.39*z-1-340);eig(H) abs(eig(H) ans =0000000000000000000000004.17244.17240.3755 + 0.1814i0.41700.3755 - 0.1814i0.4170-0.52920.5292-0.27160.27161 2Real AJ(isD- QQ2KV AJeularaf0.11930.1193可以看出,由于4.1724这个特征根的模大于1,所以可以判定闭环系统是不稳定的。3. 设描述系统的传递函数为18 s7 +514 s 6 +5982 s5 +36380 s +122664 s3 + 222088 s 2 +185760 s + 40320G(s) = 8765432s +36 s +546 s +4536 s + 22449 s + 67284 s +118124 s +109584 s + 40320具有零初始状态,请求出单位阶跃响应曲线和单位脉冲响应曲线。 num=18 514 5982 36380 122664 22088 185760 40320;den=1 36 546 4536 22449 67284 118124 109584 40320;G=tf(num,den)Transfer function:18 sA7 + 514 sA6 + 5982 sA5 + 36380 sA4 + 122664 sA3 + 22088 sA2 + 185760 s + 40320 sA8 + 36 sA7 + 546 sA6 + 4536 sA5 + 22449 sA4 + 67284 sA3 + 118124 sA2 + 109584 s + 40320 step(G,10) impulse(G,10)单位阶跃响应:1 g y B_ime i sec.Step Response单位脉冲响应:Impure Rfr&pflnseS 67 S 9 1CTime is&c)三、线性系统Simulink仿真应用1.请分析下面传递函数模型阶跃响应。1G(S)3 Ts +2s +s +2利用Simulink建模,建立系统仿真模型如下:单击启动仿真按钮,双击示波器得到系统的阶跃响应如下:2.请分析下面离散系统的脉冲响应。3s3 +4s2 +1G (s)2厂s (300 s +600 s +50 ) +3s +1利用Simulink建模,建立系统仿真模型如下:单击启动仿真按钮,双击示波器得到系统的脉冲响应如下:3.对离散采样系统进行分析,并求出其阶跃响应其中:s + 3G(S)7s2”2利用Simulink建模,建立系统仿真模型如下:A5*3rs3+7$2+35+2Z.&riOrdeFHoldT rsnsfer FdhHSoc-p num=1;den=conv( 1,1,conv( 1,1,1,1);Step(num,den);K=dcgain (num,den)得出:K =1根据图形,得出:L=1.86T=4.4利用自定义的 Ziegler_std函数求出 Kp、Ti、Td 输入: K=1;L=1.86;T=4.4;num,den,Kp,Ti,Td=Ziegler_std (3,K,L ,T) 得出:num =2.64002.83871.5262den =1 0Kp =2.8387Ti =3.7200Td =0.9300根据得出的Kp、Ti、Td值,设计PID控制器,并利用利用 Simulink仿真建模。 仿真模型及其响应如下:可见,未调节时的系统性能有待提高,需设计PID控制器连入。可见,未调节时的系统性能有待提高,需设计PID控制器连入。可见,加入PID控制器调节后,系统性能明显改善。5(S 1)未连入PID控制器时的系统仿真及其性能指标如下:可见,未调节时的系统性能有待提高,需设计PID控制器连入。可见,未调节时的系统性能有待提高,需设计PID控制器连入。1倍1叶阳叶加1Zerc-PaleESqC-C-1可见,未调节时的系统性能有待提高,需设计PID控制器连入。2 4Step Response10Time (sec)输入: num=1;den=conv(1,1,conv(1,1,; conv( 1,1,conv( 1,1,1,1 );Step(num,den);K=dcgain (num,den)得出:K = 1根据图形,得出:L=3.4T=6.8利用自定义的 Ziegler_std函数求出 Kp、Ti、Td 输入: K=1;L=3.4;T=6.8;num,den,Kp,Ti,Td=Ziegler_std (3,K, L,T)得出:num =4.08002.40000.7059den =1 0Kp =2.4000Ti =6.8000Td =1.7000可见,未调节时的系统性能有待提高,需设计PID控制器连入。2 4可见,未调节时的系统性能有待提高,需设计PID控制器连入。2 4可见,未调节时的系统性能有待提高,需设计PID控制器连入。2 4可见,加入PID控制器调节后,系统性能明显改善。-1.5s +1G(s)-(s+1)利用Simulink建模,未连入控制器时,仿真模型和响应如下:可见,未调节时的系统性能有待提高,需设计PID控制器连入。2 4可见,未调节时的系统性能有待提高,需设计PID控制器连入。2 4可见,未调节时的系统性能有待提高,需设计PID控制器连入。2 4输入:num=-1.5 1;den=conv( 1,1,conv( 1,1,1,1);Step(num,den);K=dcgain (num,den)得出:K =1根据图形,得出:L=1.8T=5.7利用自定义的 Ziegler_std函数求出Kp、Ti、Td输入: K=1;L=1.8T=5.7;num,den,Kp,Ti,Td=Ziegler_std (3,K, L,T)得出:num =3.42003.80002.1111den =1 0Kp =3.8000Ti =3.6000Td =0.9000可见,未调节时的系统性能有待提高,需设计PID控制器连入。0204060Time offset 080 100可见,加入PID控制器调节后,系统性能明显改善。五、模糊控制器设计设计任务:试设计一个模糊控制器,实现对室内温度的控制的模拟。 参考输入:(1温度18-40 C范围内分为七个论域,NB NM NS ZE PS PM PB ;隶属度函数满足高斯分布;(2)温度变化率-2 2 C范围内分为七个论域,NB NM NS ZE PS PM PB ;隶属度函数满足高斯分布;参考输出:变频空调输出的控制信号。在一定范围内分为七个论域,NB NM NS ZE PS PM PB ,隶属度函数为常数1。模糊推理过程,output=输入隶属度函数值*输出论域的中心值。注:本模糊程序采用 PAM控制方式的压缩机,则其输出的转速范围为:010500转/分。控制规则:%if input is NB and errorinput is NB, then output isNB;%if input is NB and errorinput is NM, then output isNB;%if input is NB and errorinput is NS, then output isNB;%if input is NB and errorinput is ZE, then output isNM;%if input is NB and errorinput is PS, then output isNM;%if input is NB and errorinput is PM, then output isNM;%if input is NB and errorinput is PB, then output isNS;%if input is NM and errorinput is NB, then output isNB;%if input is NM and errorinput is NM , then output isNM;%if input is NM and errorinput is NS, then output isNM;%if input is NM and errorinput is ZE, then output isNM;%if input is NM and errorinput is PS, then output isNM;%if input is NM and errorinput is PM , then output isNS;%if input is NM and errorinput is PB, then output isNS;%if input is NS and errorinput is NB, then output isNM;%if input is NS and errorinput is NM , then output isNS;%if input is NS and errorinput is NS, then output isNS;%if input is NS and errorinput is ZE, then output isNS;%if input is NS and errorinput is PS, then output isNS;%if input is NS and errorinput is PM , then output isZE;%if input is NS and errorinput is PB, then output isZE;%if input is ZE and errorinput is NB, then output isNS;%if input is ZE and errorinput is NM, then output isZE;%if input is ZE and errorinput is NS, then output isZE;%if input is ZE and errorinput is ZE, then output isZE;%if input is ZE and errorinput is PS, then output isZE;%if input is ZE and errorinput is PM, then output isPS;%if input is ZE and errorinput is PB, then output isPS;%if input is PS and errorinput is NB, then output isZE;%if input is PS and errorinput is NM , then output isPS;%if input is PS and errorinput is NS, then output isPS;%if input is PS and errorinput is ZE, then output isPS;%if input is PS and errorinput is PS, then output isPS;%if input is PS and errorinput is PM , then output isPM;%if input is PS and errorinput is PB, then output isPM;%if input is PM and errorinput is NB, then output isPS;%if input is PM and errorinput is NM , then output isPS;%if input is PM and errorinput is NS, then output isPM;%if input is PM and errorinput is ZE, then output isPM;%if input is PM and errorinput is PS, then output isPM;%if input is PM and errorinput is PM , then output isPM;%if input is PM and errorinput is PB, then output isPB;%if input is PB and errorinput is NB, then output isPS;%if input is PB and errorinput is NM, then output isPM;%if input is PB and errorinput is NS, then output isPM;%if input is PB and errorinput is ZE, then output isPM;%if input is PB and errorinput is PS, then output isPB;%if input is PB and errorinput is PM, then output isPB;%if input is PB and errorinput is PB, then output isPB;1.输入为: 程序为: x1 = (18:0.1:40);y0 = gaussmf(x1, 1 18);y1 = gaussmf(x1, 1 21);y2 = gaussmf(x1, 1 25);y3 = gaussmf(x1, 1 29);y4 = gaussmf(x1, 1 33);y5 = gaussmf(x1, 1 37);y6 = gaussmf(x1, 1 40); plot(x1,y0 y1 y2 y3 y4 y5 y6)2.误差图:程序为: x1 = (-2:0.1:2);y0 = gaussmf(x1, 0.5 -2);y1 = gaussmf(x1, 0.5 -1.3);y2 = gaussmf(x1, 0.5 -0.7);y3 = gaussmf(x1, 0.5 0);y4 = gaussmf(x1, 0.5 0.7);y5 = gaussmf(x1, 0.5 1.3);y6 = gaussmf(x1, 0.5 2); plot(x1,y0 y1 y2 y3 y4 y5 y6)3.程序为;x=35;ex=-0.8;% define input type in fuzzy zoney0 = gaussmf(x, 1 18);y1 = gaussmf(x, 1 21);y2 = gaussmf(x, 1 25);y3 = gaussmf(x, 1 29);y4 = gaussmf(x, 1 33);y5 = gaussmf(x, 1 37);y6 = gaussmf(x, 1 40);a=y0 y1 y2 y3 y4 y5 y6;b=max(a);% caculate input in fuzzy zone,get input_type and input_authorityvalue if x=18if b=a(1)type=NB ;authorityvalue=y0;elseifb=a(2)type=NM ;authorityvalue=y1;elseifb=a(3)type=NS ;authorityvalue=y2;elseifb=a(4)type=ZE ;authorityvalue=y3;elseifb=a(5)type=PS ;authorityvalue=y4;elseifb=a(6)type=PM ;authorityvalue=y5;elseifb=a(7)type=PB ;authorityvalue=y6;endelseif x40type= PB ;authorityvalue=1; elseif x18 type= NB ;authorityvalue=1; end endtypeauthorityvalue%error calculate.ey0 = gaussmf(x, 0.5 -2);ey1 = gaussmf(x, 0.5 -1.3);ey2 = gaussmf(x, 0.5 -0.7);ey3 = gaussmf(x, 0.5 0);ey4 = gaussmf(x, 0.5 0.7);ey5 = gaussmf(x, 0.5 1.3);ey6 = gaussmf(x, 0.5 2);a=ey0 ey1 ey2 ey3 ey4 ey5 ey6;b=max(a);% caculate input in fuzzy zone,get input_type and input_authorityvalue if x=-2if b=a(1) etype= NB ;eauthorityvalue=y0; elseif b=a(2) etype= NM ;eauthorityvalue=y1;elseif b=a(3) etype= NS ;eauthorityvalue=y2;elseif b=a(4) etype= ZE ; eauthorityvalue=y3;elseif b=a(5) etype= PS ; eauthorityvalue=y4;elseif b=a(6) etype= PM ; eauthorityvalue=y5;elseif b=a(7) etype= PB ; eauthorityvalue=y6;endelseif x2 etype= PB ; eauthorityvalue=1;elseif x控制系统仿真设计电气与控制工程学院测控技术与仪器0701XxXX
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!