声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1080|回复: 2

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

[复制链接]
发表于 2006-6-5 08:04 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
p=[58478 135185 5.46 0.23 16.5 0.21 1005.3 585.44;<br>  67884  152369 5.46 0.27 18.7 0.26 1105.6 575.03;<br>  74462  182563 6.01 0.25 21.6 0.28 1204.6 601.23;<br>  78345  201587 6.12 0.26 25.8 0.29 1316.5 627.89;<br>  82067  225689 6.21 0.26 30.5 0.31 1423.5 676.95;<br>  89403  240568 6.37 0.28 34.9 0.33 1536.2 716.32;<br>  95933  263856 6.38 0.28 39.8 0.36 1632.6 765.24;<br>  104790 285697 6.65 0.30 42.5 0.39 1753.2 812.22;<br>  116694 308765 6.65 0.30 46.7 0.41 1865.5 875.26]';<br>t=[102569 52365 46251;<br>   124587 60821 56245;<br>   148792 69253 67362;<br>   162568 79856 78165;<br>   186592 91658 90548;<br>   205862 99635 98758;<br>   226598 109862 102564;<br>   245636 120566 111257;<br>   263595 130378 120356]';<br>a=[1 2 3 5 7 8];<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=[P(:,1),P(:,2),P(:,3),P(:,4),P(:,5),P(:,6),P(:,7)];<br>T_train=[T(:,1),T(:,2),T(:,3),T(:,4),T(:,5),T(:,6),T(:,7)];<br>P_test=[P(:,8),P(:,9)];<br>T_test=[T(:,8),T(:,9)];<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=[y_out(1,:);y_out(2,:);y_out(3,:)];<br>y2=[y_out(4,:);y_out(5,:);y_out(6,:)];<br>y3=[y_out(7,:);y_out(8,:);y_out(9,:)];<br>y4=[y_out(10,:);y_out(11,:);y_out(12,:)];<br>y5=[y_out(13,:);y_out(14,:);y_out(15,:)];<br>y6=[y(1,:);y(2,:);y(3,:)];<br>y7=[y(4,:);y(5,:);y(6,:)];<br>y8=[y(7,:);y(8,:);y(9,:)];<br>y9=[y(10,:);y(11,:);y(12,:)];<br>y10=[y(13,:);y(14,:);y(15,:)];<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=[58478 135185 5.46 0.23 16.5 0.21 1005.3 585.44;<br>  67884  152369 5.46 0.27 18.7 0.26 1105.6 575.03;<br>  74462  182563 6.01 0.25 21.6 0.28 1204.6 601.23;<br>  78345  201587 6.12 0.26 25.8 0.29 1316.5 627.89;<br>  82067  225689 6.21 0.26 30.5 0.31 1423.5 676.95;<br>  89403  240568 6.37 0.28 34.9 0.33 1536.2 716.32;<br>  95933  263856 6.38 0.28 39.8 0.36 1632.6 765.24;<br>  104790 285697 6.65 0.30 42.5 0.39 1753.2 812.22;<br>  116694 308765 6.65 0.30 46.7 0.41 1865.5 875.26]';<br>t=[102569 52365 46251;<br>   124587 60821 56245;<br>   148792 69253 67362;<br>   162568 79856 78165;<br>   186592 91658 90548;<br>   205862 99635 98758;<br>   226598 109862 102564;<br>   245636 120566 111257;<br>   263595 130378 120356]';<br>a=[1 2 3 5 7 8];<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=[P(:,1),P(:,2),P(:,3),P(:,4),P(:,5),P(:,6),P(:,7)];<br>T_train=[T(:,1),T(:,2),T(:,3),T(:,4),T(:,5),T(:,6),T(:,7)];<br>P_test=[P(:,8),P(:,9)];<br>T_test=[T(:,8),T(:,9)];<br>No=[17 20 23];<br>for i=1:3<br>      net=newff(minmax(P),[No(i),3],{'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=[y(1,:);y(2,:);y(3,:)];<br>y2=[y(4,:);y(5,:);y(6,:)];<br>y3=[y(7,:);y(8,:);y(9,:)];<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编辑过]

回复
分享到:

使用道具 举报

 楼主| 发表于 2006-6-5 11:45 | 显示全部楼层
<P>怎么还没人来啊   </P>[em06]
发表于 2006-6-5 12:32 | 显示全部楼层

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

看不懂程序干吗
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-12 20:47 , Processed in 0.052467 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表