多种网络训练算法-bp神经网络.
P=-1:0.1:1
T=[-0.9602 -0.5770 -0.0729 0.3771 0.6405 0.6600 0.4609 0.1336 -0.2013 -0.4344 -0.5000 -.03930 -0.1647 0.0988 0.3027 0.3960 0.3449 0.1816 -0.0312 -0.2189 -0.3201]
% plot(P,T);
% s=3:8;
s=3;
% res=1:6;
% for i=1:6
% net=newff(minmax(P),[s(i),1],{'tansig','logsig'},'trainlm');
net=newff(minmax(P),[s,1],{'tansig','logsig'},'traingd');%普通梯度下降法
net=newff(minmax(P),[s,1],{'tansig','logsig'},'traingdx');%梯度下降动量法
net=newff(minmax(P),[s,1],{'tansig','logsig'},'trainlm');%Levenberg-Marquadt反传算法
net.trainParam.epochs=2500;%最大训练步数
net.trainParam.g0al=0.001;%性能参数
net=train(net,P,T)%训练权阈值
y=sim(net,P);%对神经网络进行仿真
error=y-T;%误差
% res(i)=norm(error);
res=norm(error)
% end