马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
我想做一个神经网络预测,在matlab下建模,代码如下:
p=[327.15 15390; 369.16 19.09;423.98 20.54;497.35 22.93;590.17 30.18;
721.94 35.08;878.41 41.83;1073.76 48.76;1334.20 62.48]';
t=[6.84;8.59;9.45;10.78;14.48;17.19;20.91;24.87;31.24]';
for i=1:2
P(i,:)=(p(i,:)-min(p(i,:)))/(max(p(i,:))-min(p(i,:)));
end
for i=1:1
T(i,:)=(t(i,:)-min(t(i,:)))/(max(t(i,:))-min(t(i,:)));
end
threshold=[0 1;0 1];
net=newff(threshold,[3,1],{'tansig','logsig'},'trainlm');
net.trainParam.epochs=100;
net.trainParam.goal=0.001;
LP.lr=0.1;
net=train(net,P,T);
P_test=[P(:,1) P(:,2) P(:,3) P(:,4) P(:,5) P(:,6) P(:,7) P(:,8) P(:,9)];
Out=sim(net,P_test);
X=[6.84 8.59 9.45 10.78 14.48 17.19 20.91 24.87 29.80 31.24];
plot(1:9,X-Out)
报错:??? Error using ==> minus
Matrix dimensions must agree.
请教下错在哪里,谢谢 |