赞
踩
n=[32.6 0.8584 9.37 18 0.14 0 52.1 0.06 7.51 0.6 10.76 3.79 11.74 0.27 1.07 12.54 55 1 0.0377;
32.6 0.8584 9.37 18 0.14 0 52.1 0.06 7.51 0.6 10.76 3.79 11.74 0.27 1.07 12.54 60 1 0.0389;
32.6 0.8584 9.37 18 0.14 0 52.1 0.06 7.51 0.6 10.76 3.79 11.74 0.27 1.07 12.54 65 1 0.0413;
32.6 0.8584 9.37 18 0.14 0 52.1 0.06 7.51 0.6 10.76 3.79 11.74 0.27 1.07 12.54 70 1 0.0772;
32.6 0.8584 9.37 18 0.14 0 52.1 0.06 7.51 0.6 10.76 3.79 11.74 0.27 1.07 12.54 75 1 0.0974;
20.7 0.8894 38.56 -10 0.31 0.025 34.35 0.54 8.03 0 8.8 4.59 21.7 0.08 2.59 29.2 50 1 0.0373;
20.7 0.8894 38.56 -10 0.31 0.025 34.35 0.54 8.03 0 8.8 4.59 21.7 0.08 2.59 29.2 60 1 0.0391;
20.7 0.8894 38.56 -10 0.31 0.025 34.35 0.54 8.03 0 8.8 4.59 21.7 0.08 2.59 29.2 65 1 0.0405;
20.7 0.8894 38.56 -10 0.31 0.025 34.35 0.54 8.03 0 8.8 4.59 21.7 0.08 2.59 29.2 70 1 0.0721;
20.7 0.8894 38.56 -10 0.31 0.025 34.35 0.54 8.03 0 8.8 4.59 21.7 0.08 2.59 29.2 75 1 0.0897;
20.7 0.8894 38.56 -10 0.31 0.025 34.35 0.54 8.03 0 8.8 4.59 21.7 0.08 2.59 29.2 80 1 0.0932;
20.4 0.9276 43.06 -20 0.66 0.12 47.7 0.75 11.21 1.07 2.42 5.9 33.58 0.75 21.17 9.5 50 1 0.0381;
20.4 0.9276 43.06 -20 0.66 0.12 47.7 0.75 11.21 1.07 2.42 5.9 33.58 0.75 21.17 9.5 55 1 0.0467;
20.4 0.9276 43.06 -20 0.66 0.12 47.7 0.75 11.21 1.07 2.42 5.9 33.58 0.75 21.17 9.5 65 1 0.0782;
20.4 0.9276 43.06 -20 0.66 0.12 47.7 0.75 11.21 1.07 2.42 5.9 33.58 0.75 21.17 9.5 70 1 0.093;
20.4 0.9276 43.06 -20 0.66 0.12 47.7 0.75 11.21 1.07 2.42 5.9 33.58 0.75 21.17 9.5 75 1 0.1278;
20.4 0.9276 43.06 -20 0.66 0.12 47.7 0.75 11.21 1.07 2.42 5.9 33.58 0.75 21.17 9.5 80 1 0.1496;
28.9 0.8782 13.65 13 1.12 0 11.5 0.38 0.16 1.06 8.67 3.12 70.73 0.07 46.64 1.53 50 1 0.0439;
28.9 0.8782 13.65 13 1.12 0 11.5 0.38 0.16 1.06 8.67 3.12 70.73 0.07 46.64 1.53 55 1 0.0512;
28.9 0.8782 13.65 13 1.12 0 11.5 0.38 0.16 1.06 8.67 3.12 70.73 0.07 46.64 1.53 60 1 0.0759;
28.9 0.8782 13.65 13 1.12 0 11.5 0.38 0.16 1.06 8.67 3.12 70.73 0.07 46.64 1.53 70 1 0.0992;
28.9 0.8782 13.65 13 1.12 0 11.5 0.38 0.16 1.06 8.67 3.12 70.73 0.07 46.64 1.53 75 1 0.1347;
28.9 0.8782 13.65 13 1.12 0 11.5 0.38 0.16 1.06 8.67 3.12 70.73 0.07 46.64 1.53 80 1 0.162;
33.9 0.8518 7.987 -29 1.15 0.025 90 0.47 0.57 0.28 4.25 5.29 5.87 0.02 6.86 1.05 50 1 0.0448;
33.9 0.8518 7.987 -29 1.15 0.025 90 0.47 0.57 0.28 4.25 5.29 5.87 0.02 6.86 1.05 55 1 0.0688;
33.9 0.8518 7.987 -29 1.15 0.025 90 0.47 0.57 0.28 4.25 5.29 5.87 0.02 6.86 1.05 60 1 0.0864;
33.9 0.8518 7.987 -29 1.15 0.025 90 0.47 0.57 0.28 4.25 5.29 5.87 0.02 6.86 1.05 65 1 0.1032;
33.9 0.8518 7.987 -29 1.15 0.025 90 0.47 0.57 0.28 4.25 5.29 5.87 0.02 6.86 1.05 75 1 0.1472;
33.9 0.8518 7.987 -29 1.15 0.025 90 0.47 0.57 0.28 4.25 5.29 5.87 0.02 6.86 1.05 80 1 0.1685;
31 0.8664 6.535 -31 2.64 0.025 14.6 0.12 9.1 2 3.5 1.13 12.19 0.04 39.12 0.96 50 1 0.0668;
31 0.8664 6.535 -31 2.64 0.025 14.6 0.12 9.1 2 3.5 1.13 12.19 0.04 39.12 0.96 55 1 0.0812;
31 0.8664 6.535 -31 2.64 0.025 14.6 0.12 9.1 2 3.5 1.13 12.19 0.04 39.12 0.96 60 1 0.1038;
31 0.8664 6.535 -31 2.64 0.025 14.6 0.12 9.1 2 3.5 1.13 12.19 0.04 39.12 0.96 65 1 0.1373;
31 0.8664 6.535 -31 2.64 0.025 14.6 0.12 9.1 2 3.5 1.13 12.19 0.04 39.12 0.96 70 1 0.1496;
31 0.8664 6.535 -31 2.64 0.025 14.6 0.12 9.1 2 3.5 1.13 12.19 0.04 39.12 0.96 80 1 0.1704;
31.1 0.8666 12.72 22 3.11 0 3.29 0.19 6.1 1.5 4.5 2.35 8.5 0.05 41.3 0.82 50 1 0.0715;
31.1 0.8666 12.72 22 3.11 0 3.29 0.19 6.1 1.5 4.5 2.35 8.5 0.05 41.3 0.82 55 1 0.0932;
31.1 0.8666 12.72 22 3.11 0 3.29 0.19 6.1 1.5 4.5 2.35 8.5 0.05 41.3 0.82 60 1 0.1211;
31.1 0.8666 12.72 22 3.11 0 3.29 0.19 6.1 1.5 4.5 2.35 8.5 0.05 41.3 0.82 65 1 0.1478;
31.1 0.8666 12.72 22 3.11 0 3.29 0.19 6.1 1.5 4.5 2.35 8.5 0.05 41.3 0.82 70 1 0.1532;
31.1 0.8666 12.72 22 3.11 0 3.29 0.19 6.1 1.5 4.5 2.35 8.5 0.05 41.3 0.82 75 1 0.1677;
31.1 0.8666 12.72 22 3.11 0 3.29 0.19 6.1 1.5 4.5 2.35 8.5 0.05 41.3 0.82 80 1 0.1785;
32.6 0.8584 9.37 18 0.14 0 52.1 0.06 7.51 0.6 10.76 3.79 11.74 0.27 1.07 12.54 70 0 0.0414;
32.6 0.8584 9.37 18 0.14 0 52.1 0.06 7.51 0.6 10.76 3.79 11.74 0.27 1.07 12.54 70 2 0.0849;
32.6 0.8584 9.37 18 0.14 0 52.1 0.06 7.51 0.6 10.76 3.79 11.74 0.27 1.07 12.54 70 3 0.0624;
20.7 0.8894 38.56 -10 0.31 0.025 34.35 0.54 8.03 0 8.8 4.59 21.7 0.08 2.59 29.2 70 0 0.0403;
20.7 0.8894 38.56 -10 0.31 0.025 34.35 0.54 8.03 0 8.8 4.59 21.7 0.08 2.59 29.2 70 2 0.0815;
20.4 0.9276 43.06 -20 0.66 0.12 47.7 0.75 11.21 1.07 2.42 5.9 33.58 0.75 21.17 9.5 70 0 0.0651;
20.4 0.9276 43.06 -20 0.66 0.12 47.7 0.75 11.21 1.07 2.42 5.9 33.58 0.75 21.17 9.5 70 2 0.0978;
20.4 0.9276 43.06 -20 0.66 0.12 47.7 0.75 11.21 1.07 2.42 5.9 33.58 0.75 21.17 9.5 70 3 0.0863;
28.9 0.8782 13.65 13 1.12 0 11.5 0.38 0.16 1.06 8.67 3.12 70.73 0.07 46.64 1.53 70 0 0.0658;
28.9 0.8782 13.65 13 1.12 0 11.5 0.38 0.16 1.06 8.67 3.12 70.73 0.07 46.64 1.53 70 2 0.1042;
28.9 0.8782 13.65 13 1.12 0 11.5 0.38 0.16 1.06 8.67 3.12 70.73 0.07 46.64 1.53 70 3 0.0928;
33.9 0.8518 7.987 -29 1.15 0.025 90 0.47 0.57 0.28 4.25 5.29 5.87 0.02 6.86 1.05 70 2 0.1274;
33.9 0.8518 7.987 -29 1.15 0.025 90 0.47 0.57 0.28 4.25 5.29 5.87 0.02 6.86 1.05 70 3 0.1157;
31 0.8664 6.535 -31 2.64 0.025 14.6 0.12 9.1 2 3.5 1.13 12.19 0.04 39.12 0.96 70 0 0.0891;
31 0.8664 6.535 -31 2.64 0.025 14.6 0.12 9.1 2 3.5 1.13 12.19 0.04 39.12 0.96 70 3 0.1165;
31.1 0.8666 12.72 22 3.11 0 3.29 0.19 6.1 1.5 4.5 2.35 8.5 0.05 41.3 0.82 70 0 0.0976;
31.1 0.8666 12.72 22 3.11 0 3.29 0.19 6.1 1.5 4.5 2.35 8.5 0.05 41.3 0.82 70 2 0.1638;
]
m=n'
for i=1:19;
m(i,:)=2*(m(i,:)-min(m(i,:)))/(max(m(i,:))-min(m(i,:)))-1
end
m_date=m'
a=m_date(randperm(size(m_date,1)),:);%把样本按行随机打乱
a1=a(1:40,:);
a2=a(41:59,:);
p1=a1(:,1:18);
t1=a1(:,19);
p2=a2(:,1:18);
t2=a2(:,19);
p=p1';
t=t1';
%设置网络隐单元的神经元数
n=10;
%建立相应的BP网络
net=newff(minmax(p),[n,1],{'tansig','purelin','trainlm'});
%对没有训练的网络仿真
% y1=sim(net,p);
% hold on;
%figure;
%plot(y1,'b:+');
%title('样本仿真');
%xlabel('样本');
%ylabel('腐蚀率');
%keyboard
%对网络进行训练
net.trainParam.epochs=1000;
net.trainParam.lr=0.01;%学习率
net.trainParam.goal=0.00010;%目标误差
net=train(net,p,t);%训练
%对训练的网络仿真
% y2=sim(net,p);
%figure;
%plot(y2,'-+');
%title('样本仿真1');
%xlabel('样本');
%ylabel('腐蚀率');
%keyboard
%测试样本
tp=p2';
tt=t2';
ty=sim(net,tp);
%定义误差
tE=tt-ty;
tsse=sse(tE);
tmse=mse(tE);
%测试仿真
figure;
plot(tt,'-+');
hold on;%该指令是使后来的图形包含在同一个窗口中
plot(ty,'r:*');
legend('实验值','预测值');
title('BP网络模型输出预测曲线');
xlabel('输入样本点');
ylabel('腐蚀率');
axis([0,20,-1.5,1.5]);
tyr=(ty+1)*(max(m(19,:))-min(m(19,:)))/2+min(m(19,:));
我的网络,反归一化是不是不对呀。为什么归一后输出tyr 与归一化前ty一样呢?我感觉是(max(m(19,:) min(m(19,:)
不对。因为他们输出分别为+1 和-1.
十分感谢!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。