正在加载图片...
end end M=i; %greapher绘图 i=1:M: subplot(3,1,1) plot(i,up,i,y3,i,y3,'rx") %title('step response of system using FC') xlabel('k'),ylabel('up and y3') legend('up is input','y3 is output'); subplot(3,1,2) e=0.5*(e2/6).2; plot(e) xlabel((k'),ylabel('误差e) subplot(3,1,3) plot(d*0.022) xlabel((k'),ylabel('噪声d) 2.PD控制算法 为了与模糊控制结果进行比较,采用PID控制算法对上述系统进行控制。 根据速度式的PID算式,针对被控系统选取参数,PID算式变为: M=M-0+061-05k-l+01-2a-+ e(k-2) -ek-) 用MATLAB仿真时,上述PID算式可写成: u2=ul+0.06*(1-0.5*el+0.5*(1-2*el+e0)/(1-el) PID控制算法程序如下: clear y0=0y1=0;u0=0;ve=0.1;u2=0;u1=0;d=0;e=0.01;a=0.01;e0=0;e1=0;e2=0.001;u=6;M=200; N=1; d=randn(M,1); fori=1:M d1=0.022*d(0; u1=u/6; fork=1:N u2=u1+0.06*(1-0.5*e1+0.5*(1-2*e1+e0)/1-e1) u0=u1;u1=u2; y2=0.36*y1-0.32*y0+0.71*u1+0.076*u0+d1 y3(0=y2; up(0=1; e=0.5*(u1/6-y2).2; e2(i)=e; ve=(e1-e0); e0=e1;e1=e, y0=y1; y1=y2; if e<=0.001 break;end end M=i; %greapher 绘图 i=1:M; subplot(3,1,1) plot(i,up,i,y3,i,y3,'rx') %title('step response of system using FC') xlabel('k'),ylabel('up and y3') legend('up is input','y3 is output'); subplot(3,1,2) e=0.5*(e2/6).^2; plot(e) xlabel('k'),ylabel('误差 e') subplot(3,1,3) plot(d*0.022) xlabel('k'),ylabel('噪声 d') 2.PID 控制算法 为了与模糊控制结果进行比较,采用 PID 控制算法对上述系统进行控制。 根据速度式的 PID 算式,针对被控系统选取参数,PID 算式变为: ( 2) ( ) ( 1) 0.06 1 0.5 ( 1) 0.5 1 2 ( 1) 1 ( 1) e k u k u k e k e k e k     − = − + − − + − − +       − −   用 MATLAB 仿真时,上述 PID 算式可写成: u u e e e e 2 1 0.06*(1 0.5* 1 0.5*(1 2* 1 0) / (1 1)) = + − + − + − PID 控制算法程序如下: clear y0=0;y1=0;u0=0;ve=0.1;u2=0;u1=0;d=0;e=0.01;a=0.01;e0=0;e1=0;e2=0.001;u=6;M=200; N=1; d=randn(M,1); fori=1:M d1=0.022*d(i); u1=u/6; for k=1:N u2=u1+0.06*(1-0.5*e1+0.5*(1-2*e1+e0)/(1-e1)) u0=u1;u1=u2; y2=0.36*y1-0.32*y0+0.71*u1+0.076*u0+d1; y3(i)=y2; up(i)=1; e=0.5*(u1/6-y2).^2; e2(i)=e; ve=(e1-e0); e0=e1;e1=e; y0=y1; y1=y2; if e<=0.001 break;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有