欢迎来到天天文库
浏览记录
ID:60748202
大小:51.00 KB
页数:15页
时间:2020-12-13
《PID神经元网络解耦控制算法-多变量系统控制.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、%%清空环境变量clcclear%%网络结构初始化rate1=0.006;rate2=0.001;%学习率k=0.3;K=3;y_1=zeros(3,1);y_2=y_1;y_3=y_2;%输出值u_1=zeros(3,1);u_2=u_1;u_3=u_2;%控制率h1i=zeros(3,1);h1i_1=h1i;%第一个控制量h2i=zeros(3,1);h2i_1=h2i;%第二控制量h3i=zeros(3,1);h3i_1=h3i;%第三个空置量x1i=zeros(3,1);x2i=x1i;x3i=
2、x2i;x1i_1=x1i;x2i_1=x2i;x3i_1=x3i;%隐含层输出%权值初始化k0=0.03;%第一层权值w11=k0*rand(3,2);w12=k0*rand(3,2);w13=k0*rand(3,2);%第二层权值w21=k0*rand(1,9);w22=k0*rand(1,9);w23=k0*rand(1,9);%值限定ynmax=1;ynmin=-1;%系统输出值限定xpmax=1;xpmin=-1;%P节点输出限定qimax=1;qimin=-1;%I节点输出限定qdmax=1;
3、qdmin=-1;%D节点输出限定uhmax=1;uhmin=-1;%输出结果限定%%网络迭代优化fork=1:1:200%%控制量输出计算%--------------------------------网络前向计算--------------------------%系统输出y1(k)=(0.4*y_1(1)+u_1(1)/(1+u_1(1)^2)+0.2*u_1(1)^3+0.5*u_1(2))+0.3*y_1(2);y2(k)=(0.2*y_1(2)+u_1(2)/(1+u_1(2)^2)+0.4
4、*u_1(2)^3+0.2*u_1(1))+0.3*y_1(3);y3(k)=(0.3*y_1(3)+u_1(3)/(1+u_1(3)^2)+0.4*u_1(3)^3+0.4*u_1(2))+0.3*y_1(1);r1(k)=0.7;r2(k)=0.4;r3(k)=0.6;%控制目标%系统输出限制yn=[y1(k),y2(k),y3(k)];yn(find(yn>ynmax))=ynmax;yn(find(yn5、);yn(2)];x3o=[r3(k);yn(3)];%隐含层x1i=w11*x1o;x2i=w12*x2o;x3i=w13*x3o;%比例神经元P计算xp=[x1i(1),x2i(1),x3i(1)];xp(find(xp>xpmax))=xpmax;xp(find(xp6、,h2i(2),h3i(2)];qi=qi_1+xi;qi(find(qi>qimax))=qimax;qi(find(qiqdmax))=qdmax;qd(find(qd7、h1i(3)=qd(1);h2i(3)=qd(2);h3i(3)=qd(3);%输出层计算wo=[w21;w22;w23];qo=[h1i',h2i',h3i'];qo=qo';uh=wo*qo;uh(find(uh>uhmax))=uhmax;uh(find(uh8、r=[r1(k)-y1(k);r2(k)-y2(k);r3(k)-y3(k)];error1(k)=error(1);error2(k)=error(2);error3(k)=error(3);J(k)=0.5*(error(1)^2+error(2)^2+error(3)^2);%调整大小ypc=[y1(k)-y_1(1);y2(k)-y_1(2);y3(k)-y_1(3)];uhc=[u_1(1)-u_2(1);u_1(2
5、);yn(2)];x3o=[r3(k);yn(3)];%隐含层x1i=w11*x1o;x2i=w12*x2o;x3i=w13*x3o;%比例神经元P计算xp=[x1i(1),x2i(1),x3i(1)];xp(find(xp>xpmax))=xpmax;xp(find(xp6、,h2i(2),h3i(2)];qi=qi_1+xi;qi(find(qi>qimax))=qimax;qi(find(qiqdmax))=qdmax;qd(find(qd7、h1i(3)=qd(1);h2i(3)=qd(2);h3i(3)=qd(3);%输出层计算wo=[w21;w22;w23];qo=[h1i',h2i',h3i'];qo=qo';uh=wo*qo;uh(find(uh>uhmax))=uhmax;uh(find(uh8、r=[r1(k)-y1(k);r2(k)-y2(k);r3(k)-y3(k)];error1(k)=error(1);error2(k)=error(2);error3(k)=error(3);J(k)=0.5*(error(1)^2+error(2)^2+error(3)^2);%调整大小ypc=[y1(k)-y_1(1);y2(k)-y_1(2);y3(k)-y_1(3)];uhc=[u_1(1)-u_2(1);u_1(2
6、,h2i(2),h3i(2)];qi=qi_1+xi;qi(find(qi>qimax))=qimax;qi(find(qiqdmax))=qdmax;qd(find(qd7、h1i(3)=qd(1);h2i(3)=qd(2);h3i(3)=qd(3);%输出层计算wo=[w21;w22;w23];qo=[h1i',h2i',h3i'];qo=qo';uh=wo*qo;uh(find(uh>uhmax))=uhmax;uh(find(uh8、r=[r1(k)-y1(k);r2(k)-y2(k);r3(k)-y3(k)];error1(k)=error(1);error2(k)=error(2);error3(k)=error(3);J(k)=0.5*(error(1)^2+error(2)^2+error(3)^2);%调整大小ypc=[y1(k)-y_1(1);y2(k)-y_1(2);y3(k)-y_1(3)];uhc=[u_1(1)-u_2(1);u_1(2
7、h1i(3)=qd(1);h2i(3)=qd(2);h3i(3)=qd(3);%输出层计算wo=[w21;w22;w23];qo=[h1i',h2i',h3i'];qo=qo';uh=wo*qo;uh(find(uh>uhmax))=uhmax;uh(find(uh8、r=[r1(k)-y1(k);r2(k)-y2(k);r3(k)-y3(k)];error1(k)=error(1);error2(k)=error(2);error3(k)=error(3);J(k)=0.5*(error(1)^2+error(2)^2+error(3)^2);%调整大小ypc=[y1(k)-y_1(1);y2(k)-y_1(2);y3(k)-y_1(3)];uhc=[u_1(1)-u_2(1);u_1(2
8、r=[r1(k)-y1(k);r2(k)-y2(k);r3(k)-y3(k)];error1(k)=error(1);error2(k)=error(2);error3(k)=error(3);J(k)=0.5*(error(1)^2+error(2)^2+error(3)^2);%调整大小ypc=[y1(k)-y_1(1);y2(k)-y_1(2);y3(k)-y_1(3)];uhc=[u_1(1)-u_2(1);u_1(2
此文档下载收益归作者所有