load shangxian.txt; %加载数据文件
load cedian.txt; %加载数据文件
load s00.txt; %加载数据文件
a=s00;
b=(shangxian(:,2:3));
c=(cedian(1:67,2:3));
d=zeros(1090,1);
e=(6894.76*a(1,3:69))';
tt=[e;d];
[pn,maxp,minp,tn,maxt,mint]=premnmx([c;b]',tt');%归一化ptest,p,ttest
for i=1:67
if (abs(tn(1,i)))<1.0e-3
tn(1,i)=0;
else
end
end
for m=1:2
for j=1:67
if (abs(pn(m,j)))<1.0e-3
pn(m,j)=0;
else
end
end
end
pt=(pn(:,1:67));
p=(pn(:,68:1157));
tt=tn(1,1:67);
s=3:18;
res=1:16;
for i=1:16
net=newff(minmax(pt),[s(i),1],{'tansig','logsig'},'trainlm'); %建立网络
net.trainParam.epochs=1000;
net.trainParam.goal=0.001;
net=init(net);
net=train(net,pt,tt);
wind=sim(net,pt); %网络仿真
error=wind-tt;
res(i)=norm(error);
end
w=sim(net,p);
we=(postmnmx(w,mint,maxt))'; %反归一化
save we.txt we -ascii |