最后几句输入输出怎么改?
下面程序最后输入T=0.7 N=23.204 希望能得到t中的第一个数据既:173 但是每次运行完得到的与173相差甚远 有时还是负数 怎么改呢?
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=(t-min(t))/(max(t)-min(t));
net=newff(minmax(P),,{'tansig','purelin'},'trainlm');
%net=newff(minmax(P),,{'tansig','purelin'},'traingdx');
net=init(net)
net.trainParam.epochs = 800;
net.trainParam.goal = 0.001;
=train(net,P,T);
mmin=;
mmax=;
format bank;
mp=sim(net,P).*(max(t)-min(t))+min(t)
no=;
figure;
plot(no,mmin,'ro',no,mp,'*',no,mmax,'ro');
choose=input('Do you want to test 4 groups of data,input "1" to go on or"0" to stop.');
if (choose==0),break;
else
iN=input('N: ');
it=input('T: ');
iT=(it-min(t))/(max(t)-min(t));
outmp=sim(net,').*(max(t)-min(t))+min(t)
end
特别是最后几句 我觉得不太对
焦急等待中......
焦急等待中......自己改了
最后改完的程序: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]';
P(2,:)=(p(2,:)-min(p(2,:)))/(max(p(2,:))-min(p(2,:)));
T=(t-min(t))/(max(t)-min(t));
net=newff(minmax(P),,{'tansig','purelin'},'trainlm');
%net=newff(minmax(P),,{'tansig','purelin'},'traingdx');
net=init(net)
net.trainParam.epochs = 600;
net.trainParam.goal = 0.001;
=train(net,P,T);
mmin=;
mmax=;
format bank;
mp=sim(net,P).*(max(t)-min(t))+min(t)
no=;
figure;
plot(no,mmin,'ro',no,mp,'*',no,mmax,'ro');
choose=input('Do you want to test 4 groups of data,input "1" to go on or"0" to stop.');
if (choose==0),break;
else
iN=input('N: ');
it=input('T: ');
iT=(it-min(p(2,:)))/(max(p(2,:))-min(p(2,:)));
outmp=sim(net,').*(max(t)-min(t))+min(t)
end
大家看看 运行还不错
多谢大家帮助了
有什么需要改进的 还请大家批评指正
有什么需要改进的 还请大家批评指正:handshake
页:
[1]