您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > 神经网络MATLAB程序
1模糊神经网络解耦MATLAB程序例用隶属函数型神经网与模糊控制融合的解耦程序具有耦合的两个相邻子系统的差分方程为)()()2()1()1()()()()2()1()1()(21222212121211211111kykkubkubkyakykykkubkubkyaky(7.122)式中,)(ki随机噪声;)(kyij为两个相邻子系统之间的耦合;采用隶属函数型神经网与模糊控制融合的解耦方法(DMFFCNN)方法实现解耦控制。1)开发的程序p1=0.5;q1=0.5;p2=0.5;q2=0.5;p3=0.5;q3=0.5;p4=0.95;q4=0.5;p5=0.95;q5=0.5;p6=0.95;q6=0.5;p7=0.5;q7=0.5;p8=0.95;q8=0.5;p9=0.5;q9=0.5;p10=0.95;q10=0.5;2p11=0.95;q11=0.5;p12=0.95;q12=0.5;p13=0.65;q13=0.05;%隶属函数型神经网的中心值、尺度因子和权向量初始化部分a10=[-202];a11=[-202];a20=[-202];a21=[-202];b10=[1.51.51.5];b11=[1.51.51.5];b20=[1.51.51.5];b21=[1.51.51.5];v0=[-1-0.5-0.5;-0.500.5;0.50.51];v1=[-1-0.5-0.5;-0.500.5;0.50.51];%系统部分的初值yp0=0;yp1=0;ep0=0;ep1=0;up0=1.05;up1=1.39;x1=0.12;x2=0.24;y0=0;y1=0;u1=0;e0=0;e1=0;sp=10;k=1;se=0.02;sd=0.02;su=0.0522;%开始3kp=0.284;ki=0.03;kd=0.626;%thesecondchannelreferencep12=0.5;q12=0.5;p22=0.5;q22=0.5;p32=0.5;q32=0.5;p42=0.95;q42=0.5;p52=0.95;q52=0.5;p62=0.95;q62=0.5;p72=0.5;q72=0.5;p82=0.95;q82=0.5;p92=0.5;q92=0.5;p102=0.95;q102=0.5;p112=0.95;q112=0.5;p122=0.95;q122=0.5;p132=0.65;q132=0.05;%系统部分的初值4yp02=0;yp12=0;ep02=0;ep12=0;up02=1.05;up12=1.39;x12=0.12;x22=0.24;y02=0;y12=0;u12=0;e02=0;e12=0;sp2=5;k=1;se2=0.02;sd2=0.02;su2=0.0522;kp2=0.284;ki2=0.03;kd2=0.626;%+++++++++++++++++++++++++++++++++++++++%子系统1(SUB1)的J循环开始forJ=1:50ep1=10-yp1;pid=kp*(ep1-ep0)+ki*ep1;up2=up1+pid;yp2=0.5*yp1+2.5*up2+2.5*up1;%yp2=0.8333*yp1-0.1667*yp0+1.6667*up2+1.6667*up1;yp(:,J)=yp2;up0=up1;up1=up2;ep0=ep1;yp0=yp1;yp1=yp2;endtime=[1:1:50];n=0.28*rand(size(time));%产生的SUB1随机噪声5n1=0.3*rand(size(time));%产生的SUB2随机噪声while(k=50)%functiondealwithfor(T=1:20)X1=x1*se;X2=x2*sd;if(X1=-2)X1=-2;elseif(X1=2)X1=2;endif(X2=-2)X2=-2;elseif(X2=2)X2=2;end%thehiddeninglayeroutputofFNNfori=1:3forj=1:3A=[(X1-a11(:,i))/b11(:,i)].^2;B=[(X2-a21(:,j))/b21(:,j)].^2;h(i,j)=exp(-(A+B)/2);endend%theoutputsum=0;fori=1:3forj=1:3sum=sum+h(i,j)*v1(i,j);endendot=sum;cu=su*ot;u2=u1+cu;disp(u2);if(u20)6u2=0;elseif(u2=1)u2=1;endy2=0.5*y1+2.5*u2+2.5*u1+n1(:,k)+0.01*y12;%+n1(:,k)+0.01*y12表示随机噪声和子系统间的相互耦合disp(['theoutputynumberis'int2str(T)]);disp(y2);Y(:,k)=y2;E=0.5*(sp-y2).^2;e2=sp-y2;Es(:,k)=e2;x1=e2;x2=e2-e1;e0=e1;e1=e2;delot=(sp-y2)*2.5*su;fori=1:3forj=1:3dv=v1(i,j)-v0(i,j);v2=v1(i,j)+p13*delot+q13*dv;v3(i,j)=v2;endend%refreshingthecenterandwidth%a11s1=0;forj=1:3s1=s1+v1(1,j)*h(1,j);endpa11=s1;a110=a10(:,1);a111=a11(:,1);dela11=pa11*(X1-a111)/b11(:,1).^2;7da11=a111-a110;a112=a111+p1*dela11+q1*da11;a10(:,1)=a111;a11(:,1)=a112;%a12s2=0;forj=1:3s2=s2+v1(2,j)*h(2,j);endpa12=s2;a120=a10(:,2);a121=a11(:,2);dela12=pa12*(X1-a121)/b11(:,2).^2;da12=a121-a120;a122=a121+p2*dela12+q2*da12;a10(:,2)=a121;a11(:,2)=a122;%a13s3=0;forj=1:3s3=s3+v1(3,j)*h(3,j);endpa13=s3;a130=a10(:,3);a131=a11(:,3);dela13=pa13*(X1-a131)/b11(:,3).^2;da13=a131-a130;a132=a131+p3*dela13+q3*da13;a10(:,3)=a131;a11(:,3)=a132;%b11pb11=pa11;b110=b10(:,1);b111=b11(:,1);delb11=pb11*[(X1-a111)].^2/b111.^3;db11=b111-b110;b112=b111+p4*delb11+q4*db11;b10(:,1)=b111;8b11(:,1)=b112;%b12pb12=pa12;b120=b10(:,2);b121=b11(:,2);delb12=pb12*[(X1-a121)].^2/b121.^3;db12=b121-b120;b122=b121+p5*delb12+q5*db12;b10(:,2)=b121;b11(:,2)=b122;%b13pb13=pa13;b130=b10(:,3);b131=b11(:,3);delb13=pb13*[(X1-a131)].^2/b131.^3;db13=b131-b130;b132=b131+p6*delb13+q6*db13;b10(:,3)=b131;b11(:,3)=b132;%a21s4=0;fori=1:3s4=s4+v1(i,1)*h(i,1);endpa21=s4;a210=a20(:,1);a211=a21(:,1);dela21=pa21*(X2-a211)/b21(:,1).^2;da21=a211-a210;a212=a211+p7*dela21+q7*da21;a20(:,1)=a211;a21(:,1)=a212;%a22s5=0;fori=1:3s5=s5+v1(i,2)*h(i,2);endpa22=s5;9a220=a20(:,2);a221=a21(:,2);dela22=pa22*(X2-a221)/b21(:,2).^2;da22=a221-a220;a222=a221+p8*dela22+q8*da22;a20(:,2)=a221;a21(:,2)=a222;%a23s6=0;fori=1:3s6=s6+v1(i,3)*h(i,3);endpa23=s6;a230=a20(:,3);a231=a21(:,3);dela23=pa23*(X2-a231)/b21(:,3).^2;da23=a231-a230;a232=a231+p9*dela23+q3*da23;a20(:,3)=a231;a21(:,3)=a232;%b21pb21=pa21;b210=b20(:,1);b211=b21(:,1);delb21=pb21*[(X2-a211)].^2/b211.^3;db21=b211-b210;b212=b211+p10*delb21+q10*db21;b20(:,1)=b211;b21(:,1)=b212;%b22pb22=pa22;b220=b20(:,2);b221=b21(:,2);delb22=pb22*[(X2-a221)].^2/b221.^3;db22=b221-b220;b222=b221+p11*delb22+q11*db22;b20(:,2)=b221;b21(:,2)=b222;10%b23pb23=pa23;b230=b20(:,3);b231=b21(:,3);delb23=pb23*[(X2-a231)].^2/b231.^3;db23=b231-b230;b232=b231+p12*delb23+q12*db23;b20(:,3)=b231;b21(:,3)=b232;v0=v1;v1=v3;if(abs(e1)0.00015)break;endenda11a21b11b21v3y0=y1;y1=y2u0=u1;u1=u2;%addingthesecondchannel%权向量初始化部分a102=[-202];a112=[-202];a202=[-202];a212=[-202];b102=[1.51.51.5];b112=[1.51.51.5];b202=[1.51.51.5];11b212=[1.51.51.5];v02=[-1-0.5-0.5;-0.500.5;0.50.51];v12=[-1-0.5-0.5;-0.500.5;0.50.51];%+++++++++++++++++++++++++++++++++++++%子系统2(SUB2)的J循环开始forJ=1:100ep2=5-yp12;pid2=kp2*(ep12-ep02)+ki2*ep12;up22=up12+pid2;yp22=0.5*yp12+1.25*up22+1.25*up12;%yp2=0.8333*yp1-0.1667*yp0+1.6667*up2+1.6667*up1;yp2(:,J)=yp22;up02=up12;up12=up22;ep02=ep12;yp02=yp12;yp12=yp22;end%while(k=250)%functiondealwidthfor(T=1:20)X12=x12*se2;X22=x22*sd2;if(X12=-2)X12=-2;elseif(X12=2)X12=2;endif(X22=-2)X22=-2;elseif(X22=2)X22=2;end%thehiddeningl
本文标题:神经网络MATLAB程序
链接地址:https://www.777doc.com/doc-4558094 .html