BP神经网络预测—matlab程序出错,求大神帮忙分析下

P = [0.1515 0.1501 0.1509 0.1504 0.1504 0.1500
0.1515 0.1501 0.1509 0.1504 0.1504 0.1500
0.1515 0.1501 0.1500 0.1504 0.1504 0.1500
0.1515 0.1500 0.1509 0.1504 0.1504 0.1500
0.1515 0.1500 0.1509 0.1504 0.1504 0.1500
0.1515 0.1500 0.1509 0.1504 0.1504 0.1500
0.9684 0.2792 0.877 0.7426 0.7228 0.2272
0.9838 0.2941 0.9181 0.7977 0.7702 0.2452
0.9922 0.3101 0.9475 0.8445 0.8227 0.2665
0.9953 0.3058 0.9625 0.8708 0.8637 0.2624
0.9982 0.3242 0.9797 0.9089 0.9001 0.3008
0.9995 0.3469 0.9917 0.9314 0.9282 0.3678
0.9998 0.3565 0.9948 0.9493 0.9525 0.4500];
T= [0.1521
0.6949
0.7064
0.7083
0.7560
0.7807
0.8182
0.8533
0.8677
0.8459
0.8910
0.9269
0.9496];
ff=newff(P,T,13);
ff.trainParam.epochs = 15000;
ff = train(ff,P,T);
Y1 = sim(ff,P);
cf=newcf(P,T,13);
cf.trainParam.epochs = 15000;
cf = train(cf,P,T);
Y2 = sim(cf,P);
plot(P,T,'o-');
hold on;
plot(P,Y1,'^m-');
plot(P,Y2,'*-k');
title('newff & newcf')
legend('原始数据','newff结果','newcf结果,0)
Error using network/train (line 325)
Inputs and targets have different numbers of samples.

P,T是归一化的结果,用了两种不同的代码运行,结果都是Error using network/train (line 325)
Inputs and targets have different numbers of samples. 请问,是归一化的数据不对,还是隐含层设置不对,还是代码哪里有误?请各位大神帮帮忙,非常感谢!

第1个回答  2014-03-26
大哥,在ff=newff(P,T,13);前面加一句

P=P';
T=T';

看看是不是您要的效果本回答被提问者采纳
相似回答