clc;
clear;
close all;clf;
%e表示时间,用1、2、3、4、5等来表示时间点,间隔为6小时
e=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
];
%f表示纬度,单位是0.1度
f=[180 183 186 188 189 190 191 191 188 185 181 178 177 177 178 178 176 172 168 166 165 165 166 168 171 175 177 178 178 178 182 188 186 184 182
];
%g表示经度,单位是0.1度
g=[1395 1388 1382 1378 1375 1371 1368 1361 1356 1351 1342 1330 1317 1304 1289 1274 1257 1241 1227 1209 1194 1186 1178 1168 1158 1150 1142 1136 1130 1120 1111 1099 1090 1084 1082
];
%h表示中心最低气压
h=[1006 1004 1002 1000 1000 1000 998 992 990 985 980 980 975 970 965 960 950 950 940 950 960 965 975 980 980 980 980 980 985 990 990 990 998 1000 1000
];
%i表示速度
i=[12 12 15 15 15 18 20 23 25 28 30 30 33 35 38 40 45 45 50 45 40 38 33 30 30 30 30 30 28 25 25 23 18 15 13
];
%j表示强度
j=[1 1 1 1 1 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 4 4 4 3 3 3 3 3 3 3 3 2 2 1 1];
p=[e;f;g];
t=[h;i;j];
[pn,minp,maxp,tn,mint,maxt]=premnmx(p,t);%归一化处理
dx=[-1,1;-1,1;-1,1];%归一化后的数据区间
net=newff(dx,[3,11,3],{'tansig','tansig','purelin'},'traingdx');%采用最小梯度法,一共三层,第1,3层3个神经元,第2层11个神经元
net.trainParam.show=1000;%每1000回显示一次数据
net.trainParam.Lr=0.05;%步长
net.trainParam.epochs=50000;%最大轮回次数为50000
net.trainParam.goal=0.65*10^(-3);%均方误差
net=train(net,pn,tn);%训练
an=sim(net,pn);%仿真结果,预测结果
a=postmnmx(an,mint,maxt);%逆归一化后,返回仿真后的结果
x=1:35;
newk=a(1,:);
newh=a(2,:);
newi=a(3,:)%神经预测出的值与真实值的比较
figure(3);
subplot(3,1,1);plot(x,newk,'r-o',x,h,'b--+')
legend('网络输出气压','实际气压');
xlabel('时间');ylabel('气压强度');
title('运用工具箱气压学习和测试对比图');
subplot(3,1,2);plot(x,newh,'r-o',x,i,'b--+');
legend('网络输出速度','实际速度');
xlabel('时间');ylabel('速度大小');
title('运用工具箱速度学习和测试对比图');
subplot(3,1,3);plot(x,newi,'r-o',x,j,'b--+');
legend('网络输出强度','实际强度');
xlabel('时间');ylabel('强度大小');
title('运用工具箱速度学习和测试对比图');
pnew=[36 37
180 180
1078 1074];
pnewn=tramnmx(pnew,minp,maxp);
anewn=sim(net,pnewn);
anew=postmnmx(anewn,mint,maxt)