《2022年温度控制传递函数_增量式PID系数_MATLAB仿真 .pdf》由会员分享,可在线阅读,更多相关《2022年温度控制传递函数_增量式PID系数_MATLAB仿真 .pdf(9页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、clear all; close all; ts=0.1; sys=tf(5,8,1,inputdelay,10); dsys=c2d(sys,ts,zoh); num,den=tfdata(dsys,v); u_1=0;u_2=0;u_3=0;u_4=0;u_5=0; y_1=0;y_2=0;y_3=0; error_1=0;error_2=0; x=0,0,0; for k=1:1:200 time(k)=k*ts; yout(k)=-den(2)*y_1+num(2)*u_5; rin(k)=1; error(k)=rin(k)-yout(k); kp=1; ki=0; kd=0; du
2、(k)=kp*x(1)+kd*x(2)+ki*x(3); u(k)=u_1+du(k); u_5=u_4;u_4=u_3;u_3=u_2;u_2=u_1;u_1=u(k); y_3=y_2;y_2=y_1;y_1=yout(k); x(1)= error(k)-error_1; x(2)= error(k)-2*error_1+error_2; x(3)= error(k); error_2=error_1; error_1=error(k); end hold on hold on plot(time,rin,g,time,yout,r,linewidth,2) xlabel(time(s)
3、 ylabel(rin,yout) ts=0.1; sys=tf(5,8,1,inputdelay,10); dsys=c2d(sys,ts,zoh); num,den=tfdata(dsys,v); u_1=0;u_2=0;u_3=0;u_4=0;u_5=0; y_1=0;y_2=0;y_3=0; error_1=0;error_2=0; x=0,0,0; for k=1:1:200 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 9 页 - - - - - - - -
4、 - time(k)=k*ts; yout(k)=-den(2)*y_1+num(2)*u_5; rin(k)=1; error(k)=rin(k)-yout(k); kp=2; ki=0; kd=0; du(k)=kp*x(1)+kd*x(2)+ki*x(3); u(k)=u_1+du(k); u_5=u_4;u_4=u_3;u_3=u_2;u_2=u_1;u_1=u(k); y_3=y_2;y_2=y_1;y_1=yout(k); x(1)= error(k)-error_1; x(2)= error(k)-2*error_1+error_2; x(3)= error(k); error_
5、2=error_1; error_1=error(k); end hold on plot(time,yout,b,linewidth,2) xlabel(time(s) ylabel(rin,yout) ts=0.1; sys=tf(5,8,1,inputdelay,10); dsys=c2d(sys,ts,zoh); num,den=tfdata(dsys,v); u_1=0;u_2=0;u_3=0;u_4=0;u_5=0; y_1=0;y_2=0;y_3=0; error_1=0;error_2=0; x=0,0,0; for k=1:1:200 time(k)=k*ts; yout(k
6、)=-den(2)*y_1+num(2)*u_5; rin(k)=1; error(k)=rin(k)-yout(k); kp=3; ki=0; kd=0; du(k)=kp*x(1)+kd*x(2)+ki*x(3); u(k)=u_1+du(k); u_5=u_4;u_4=u_3;u_3=u_2;u_2=u_1;u_1=u(k); y_3=y_2;y_2=y_1;y_1=yout(k); x(1)= error(k)-error_1; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第
7、 2 页,共 9 页 - - - - - - - - - x(2)= error(k)-2*error_1+error_2; x(3)= error(k); error_2=error_1; error_1=error(k); end hold on plot(time,yout,m,linewidth,2) xlabel(time(s) ylabel(rin,yout) 图像: ki=0 ,kd=0 Kp:红色 kp=1,蓝色 kp=2,品红 kp=3 clear all; close all; ts=0.1; sys=tf(5,8,1,inputdelay,10); dsys=c2d(sy
8、s,ts,zoh); num,den=tfdata(dsys,v); u_1=0;u_2=0;u_3=0;u_4=0;u_5=0; y_1=0;y_2=0;y_3=0; error_1=0;error_2=0; x=0,0,0; for k=1:1:200 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 9 页 - - - - - - - - - time(k)=k*ts; yout(k)=-den(2)*y_1+num(2)*u_5; rin(k)=1; error(k
9、)=rin(k)-yout(k); kp=2; ki=0.01; kd=0; du(k)=kp*x(1)+kd*x(2)+ki*x(3); u(k)=u_1+du(k); u_5=u_4;u_4=u_3;u_3=u_2;u_2=u_1;u_1=u(k); y_3=y_2;y_2=y_1;y_1=yout(k); x(1)= error(k)-error_1; x(2)= error(k)-2*error_1+error_2; x(3)= error(k); error_2=error_1; error_1=error(k); end hold on hold on plot(time,rin,
10、g,time,yout,r,linewidth,2) xlabel(time(s) ylabel(rin,yout) ts=0.1; sys=tf(5,8,1,inputdelay,10); dsys=c2d(sys,ts,zoh); num,den=tfdata(dsys,v); u_1=0;u_2=0;u_3=0;u_4=0;u_5=0; y_1=0;y_2=0;y_3=0; error_1=0;error_2=0; x=0,0,0; for k=1:1:200 time(k)=k*ts; yout(k)=-den(2)*y_1+num(2)*u_5; rin(k)=1; error(k)
11、=rin(k)-yout(k); kp=2; ki=0.02; kd=0; du(k)=kp*x(1)+kd*x(2)+ki*x(3); u(k)=u_1+du(k); u_5=u_4;u_4=u_3;u_3=u_2;u_2=u_1;u_1=u(k); y_3=y_2;y_2=y_1;y_1=yout(k); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 9 页 - - - - - - - - - x(1)= error(k)-error_1; x(2)= error(
12、k)-2*error_1+error_2; x(3)= error(k); error_2=error_1; error_1=error(k); end hold on plot(time,yout,b,linewidth,2) xlabel(time(s) ylabel(rin,yout) ts=0.1; sys=tf(5,8,1,inputdelay,10); dsys=c2d(sys,ts,zoh); num,den=tfdata(dsys,v); u_1=0;u_2=0;u_3=0;u_4=0;u_5=0; y_1=0;y_2=0;y_3=0; error_1=0;error_2=0;
13、 x=0,0,0; for k=1:1:200 time(k)=k*ts; yout(k)=-den(2)*y_1+num(2)*u_5; rin(k)=1; error(k)=rin(k)-yout(k); kp=2; ki=0.05; kd=0; du(k)=kp*x(1)+kd*x(2)+ki*x(3); u(k)=u_1+du(k); u_5=u_4;u_4=u_3;u_3=u_2;u_2=u_1;u_1=u(k); y_3=y_2;y_2=y_1;y_1=yout(k); x(1)= error(k)-error_1; x(2)= error(k)-2*error_1+error_2
14、; x(3)= error(k); error_2=error_1; error_1=error(k); end hold on plot(time,yout,m,linewidth,2) xlabel(time(s) ylabel(rin,yout) 图像: kp=2,kd=0 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 9 页 - - - - - - - - - Ki:红色 ki =0.01,蓝色 ki =0.02,品红 ki =0.05 clear all; c
15、lose all; ts=0.1; sys=tf(5,8,1,inputdelay,10); dsys=c2d(sys,ts,zoh); num,den=tfdata(dsys,v); u_1=0;u_2=0;u_3=0;u_4=0;u_5=0; y_1=0;y_2=0;y_3=0; error_1=0;error_2=0; x=0,0,0; for k=1:1:200 time(k)=k*ts; yout(k)=-den(2)*y_1+num(2)*u_5; rin(k)=1; error(k)=rin(k)-yout(k); kp=2; ki=0.02; kd=1; du(k)=kp*x(
16、1)+kd*x(2)+ki*x(3); u(k)=u_1+du(k); u_5=u_4;u_4=u_3;u_3=u_2;u_2=u_1;u_1=u(k); y_3=y_2;y_2=y_1;y_1=yout(k); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 9 页 - - - - - - - - - x(1)= error(k)-error_1; x(2)= error(k)-2*error_1+error_2; x(3)= error(k); error_2=err
17、or_1; error_1=error(k); end hold on hold on plot(time,rin,g,time,yout,r,linewidth,2) xlabel(time(s) ylabel(rin,yout) ts=0.1; sys=tf(5,8,1,inputdelay,10); dsys=c2d(sys,ts,zoh); num,den=tfdata(dsys,v); u_1=0;u_2=0;u_3=0;u_4=0;u_5=0; y_1=0;y_2=0;y_3=0; error_1=0;error_2=0; x=0,0,0; for k=1:1:200 time(k
18、)=k*ts; yout(k)=-den(2)*y_1+num(2)*u_5; rin(k)=1; error(k)=rin(k)-yout(k); kp=2; ki=0.02; kd=2; du(k)=kp*x(1)+kd*x(2)+ki*x(3); u(k)=u_1+du(k); u_5=u_4;u_4=u_3;u_3=u_2;u_2=u_1;u_1=u(k); y_3=y_2;y_2=y_1;y_1=yout(k); x(1)= error(k)-error_1; x(2)= error(k)-2*error_1+error_2; x(3)= error(k); error_2=erro
19、r_1; error_1=error(k); end hold on plot(time,yout,b,linewidth,2) xlabel(time(s) ylabel(rin,yout) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 9 页 - - - - - - - - - ts=0.1; sys=tf(5,8,1,inputdelay,10); dsys=c2d(sys,ts,zoh); num,den=tfdata(dsys,v); u_1=0;u_2=0;
20、u_3=0;u_4=0;u_5=0; y_1=0;y_2=0;y_3=0; error_1=0;error_2=0; x=0,0,0; for k=1:1:200 time(k)=k*ts; yout(k)=-den(2)*y_1+num(2)*u_5; rin(k)=1; error(k)=rin(k)-yout(k); kp=2; ki=0.02; kd=3; du(k)=kp*x(1)+kd*x(2)+ki*x(3); u(k)=u_1+du(k); u_5=u_4;u_4=u_3;u_3=u_2;u_2=u_1;u_1=u(k); y_3=y_2;y_2=y_1;y_1=yout(k)
21、; x(1)= error(k)-error_1; x(2)= error(k)-2*error_1+error_2; x(3)= error(k); error_2=error_1; error_1=error(k); end hold on plot(time,yout,m,linewidth,2) xlabel(time(s) ylabel(rin,yout) 图像: kp=2,ki=0.1 Kp:红色 kp =1,蓝色 kp =2,品红 kp =3 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 9 页 - - - - - - - - - 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 9 页 - - - - - - - - -