t2145011 发表于 2006-6-5 08:04

[求助]各位高手帮帮看看

p=';<br>t=';<br>a=;<br>P=p;<br>for i=1:6<br>P(a(i),:)=(p(a(i),:)-min(p(a(i),:)))/(max(p(a(i),:))-min(p(a(i),:)));<br>end<br>for i=1:3<br>T(i,:)=(t(i,:)-min(t(i,:)))/(max(t(i,:))-min(t(i,:)));<br>end<br>P_train=;<br>T_train=;<br>P_test=;<br>T_test=;<br>for i=1:5<br>   net=newgrnn(P_train,T_train,i/10);<br>   temp=sim(net,P_train);<br>   j=3*i;<br>   y_out(j-2,:)=temp(1,:);<br>   y_out(j-1,:)=temp(2,:);<br>   y_out(j,:)=temp(3,:);<br>   temp=sim(net,P_test);<br>   y(j-2,:)=temp(1,:);<br>   y(j-1,:)=temp(2,:);<br>   y(j,:)=temp(3,:);<br>end<br>y1=;<br>y2=;<br>y3=;<br>y4=;<br>y5=;<br>y6=;<br>y7=;<br>y8=;<br>y9=;<br>y10=;<br>for i=1:7<br>   error1(i)=norm(y1(:,i)-T_train(:,i));<br>   error2(i)=norm(y2(:,i)-T_train(:,i));<br>   error3(i)=norm(y3(:,i)-T_train(:,i));<br>   error4(i)=norm(y4(:,i)-T_train(:,i));<br>   error5(i)=norm(y5(:,i)-T_train(:,i));<br>end<br>for i=1:2<br>   error6(i)=norm(y6(:,i)-T_test(:,i));<br>   error7(i)=norm(y7(:,i)-T_test(:,i));<br>   error8(i)=norm(y8(:,i)-T_test(:,i));<br>   error9(i)=norm(y9(:,i)-T_test(:,i));<br>   error10(i)=norm(y10(:,i)-T_test(:,i));<br>end<br>plot(1:7,error1,'-*');<br>hold on;<br>plot(1:7,error2,'-+');<br>hold on;<br>plot(1:7,error3,'-h');<br>hold on;<br>plot(1:7,error4,'-d');<br>hold on;<br>plot(1:7,error5,'-o');<br>hold off;<br>figure;<br>plot(1:2,error6,'-*');<br>hold on;<br>plot(1:2,error7,'-+');<br>hold on;<br>plot(1:2,error8,'-h');<br>hold on;<br>plot(1:2,error9,'-d');<br>hold on;<br>plot(1:2,error10,'-o');<br>hold off;<br>这是GRNN搞的,我参照书上的用BP搞了个,数据就是上面那段程序的数据,大概意思就是要用BP搞出个和上面GRNN差不多的,麻烦各位看看 看看有没有那些地方做错了,还有就是是否和那个GRNN相关<br>p=';<br>t=';<br>a=;<br>P=p;<br>for i=1:6<br>P(a(i),:)=(p(a(i),:)-min(p(a(i),:)))/(max(p(a(i),:))-min(p(a(i),:)));<br>end<br>for i=1:3<br>T(i,:)=(t(i,:)-min(t(i,:)))/(max(t(i,:))-min(t(i,:)));<br>end<br>P_train=;<br>T_train=;<br>P_test=;<br>T_test=;<br>No=;<br>for i=1:3<br>      net=newff(minmax(P),,{'tansig','logsig'});<br>      net.trainParam.epochs=500;<br>      net=init(net);<br>      net=train(net,P,T);<br>      temp=sim(net,P_test);<br>      y(3*i-2,:)=temp(1,:);<br>      y(3*i-1,:)=temp(2,:);<br>      y(3*i,:)=temp(3,:);<br>end<br>y1=;<br>y2=;<br>y3=;<br>for i=1:2<br>   error1(i)=norm(y1(:,i)-T_test(:,i));<br>   error2(i)=norm(y2(:,i)-T_test(:,i));<br>   error3(i)=norm(y3(:,i)-T_test(:,i));<br>end<br>figure;<br>plot(1:2,error1,'-*');<br>hold on;<br>plot(1:2,error2,'-+');<br>hold on;<br>plot(1:2,error3,'-o');<br>hold off;
[此贴子已经被cdwxg于2006-6-5 13:32:14编辑过]

t2145011 发表于 2006-6-5 11:45

<P>怎么还没人来啊   </P>

linux853 发表于 2006-6-5 12:32

回复:(t2145011)[计算编程][求助]各位高手帮帮看看...

看不懂程序干吗
页: [1]
查看完整版本: [求助]各位高手帮帮看看