matlab BP神经网络(转)
把训练数据拷入,load的*.m文件中,文件中部load的*.m为测试数据
save 存盘的文件为测试数据的bp预测值,
该程序可以扩充n个输入,n个输出,很容易
load osforce2.m;
a=osforce2';
load osgap2.m;
b=osgap2';
=premnmx(b,a);
net=init(net);
net=newff([-1 1],,{'tansig','logsig','purelin'},'traingdm');
net.trainParam.show = 50;
net.trainParam.lr = 0.05;
net.trainParam.epochs = 10000;
net.trainParam.goal = 1e-5;
net=train(net,nb,na);
nc= sim(net,nb);
c=postmnmx(nc,mina,maxa);
load osgap2.m;
test=osgap2';
=premnmx(test);
nnetout= sim(net,ntest);
netout=postmnmx(nnetout,mina,maxa);
load osforce2.m;
real=osforce2';
me=mean(real-netout)
st=std(netout-real)
save d:\wzy.txt c -ASCII;
load spssyce.m;
spss=spssyce';
sts=std(real-spss)
页:
[1]