基于PSO优化BP神经网络PID控制器的仿真,使用matlab2021a或者更高版本测试
for j=1:1:H
Oh(j)=( exp( net2(j)-exp(-net2(j)) ) )/(exp( net2(j)+exp(-net2(j)) ));
end
net3=wo*Oh;
for l=1:1:Out
K(l)=exp(net3(l))/(exp(net3(l))+exp(-net3(l)));
%K(l)=M*net3(l);
end
kp(k)=M(1)*K(1); ki(k)=M(2)*K(2); kd(k)=M(3)*K(3);
Kpid=[kp(k),ki(k),kd(k)];
du(k)=Kpid*epid;
u(k)=u_1+du(k);