我觉得你应该自己多想想,试着自己解决问题,不要一有问题就马上问.
我将线性网络改为BP网络试了一下,余下你自己多想想吧:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
p=[0.7 23.204;
0.533 23.911;
0.7 24.024;
0.533 28.003;
0.533 29.901;
0.7 25.488;
0.533 25.472;
0.4 19.569;
0.4 24.087;
0.7 27.297;
0.533 33.793;
0.533 36.363;
0.533 30.672;
0.533 32.189;]';
t=[173;
157.5;
178.5 ;
126;
181.5;
150;
149;
143.5;
169;
174.5;
149;
119;
107;
123]';
for i=1:2
P(i,:)=(p(i,:)-min(p(i,:)))./(max(p(i,:))-min(p(i,:)));
end
T(1,:)=(t(1,:)-min(t(1,:)))./(max(t(1,:))-min(t(1,:)));
net=newff(minmax(P),[5,1],{'tansig','purelin'},'trainlm');
net=init(net)
net.trainParam.epochs = 2000;
net.trainParam.goal = 0.001;
[net,tr]=train(net,P,T);
%%%%%%%%%%%%%%%%%%%%%%%%%%% |