⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flch7eg2.m

📁 刚刚接触神经网络的朋友们看了这本书会有一定得帮助的!!
💻 M
字号:
% 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);
for i=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.132*y0+0.66*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; %判断误差
else
end
end  %对应for k=1:N
end  %循环结束
M=i
%greapher
i=1:M;
subplot(3,1,1)
plot(i,up,i,y3,i,y3,'rx')
%title('step response of system'),
xlabel('k'),ylabel('up  and  y3')
 legend('up is system input','y3 is system output'); %图标炷 
subplot(3,1,2)
plot(e2)
xlabel('k'),ylabel('误差e')
subplot(3,1,3)
plot(d*0.022)
xlabel('k'),ylabel('噪声d')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -