关于matlab矩阵输入的问题,请大家帮忙看看
我编了一个如下的bp网络程序,p=[3 0.3 1.6 0.4 0.1 0.05;
3 0.3 0.1 0.5 0.2 0.1;
3 0.3 0.8 0.7 0.4 0.3;
3 0.6 0.1 0.4 0.2 0.3;
3 0.6 0.8 0.5 0.4 0.05;
3 0.6 1.6 0.7 0.1 0.1;
3 1.2 0.8 0.4 0.4 0.1;
3 1.3 1.6 0.5 0.1 0.3;
3 1.2 0.1 0.7 0.2 0.05;
4 0.3 0.8 0.4 0.1 0.05;
4 0.3 1.6 0.5 0.2 0.1;
4 0.3 0.1 0.7 0.4 0.3;
4 0.6 1.6 0.4 0.2 0.3;
4 0.6 0.1 0.5 0.4 0.05;
4 0.6 0.8 0.7 0.1 0.1;
4 1.2 0.8 0.4 0.4 0.1;
4 1.2 1.6 0.5 0.1 0.3;
4 1.2 0.1 0.7 0.2 0.05;
5 0.3 1.6 0.4 0.1 0.05;
5 0.3 0.1 0.5 0.2 0.1;
5 0.3 0.8 0.7 0.4 0.3;
5 0.6 0.1 0.4 0.2 0.3;
5 0.6 0.8 0.5 0.4 0.05;
5 0.6 1.6 0.7 0.1 0.1;
5 1.2 0.8 0.4 0.4 0.1;
5 1.2 1.6 0.5 0.1 0.3];
p=p'
t=[32.13 50.3;
32.27 13.7;
29.93 63.0;
30.20 6.40;
33.00 55.5;
30.90 69.0;
29.60 53.6;
29.50 61.5;
29.40 10.9;
33.60 50.4;
34.10 68.7;
33.22 18.7;
33.20 72.2;
32.48 28.6;
33.55 60.1;
28.95 55.8;
29.72 65.6;
23.95 5.60;
25.66 71.3;
21.36 26.3;
24.30 61.2;
24.84 4.40;
21.50 57.5;
25.88 63.6;
23.14 54.0;
24.30 68.3];
t=t';
=premnmx(p,t);
net=newff([-1,1],,{'tansig','logsig','purelin'},'traingd');
net=init(net);
net.trainParam.show = 50;
net.trainParam.lr = 0.05;
net.trainParam.epochs = 10000;
net.trainParam.goal = 0.1;
net=train(net,np,nt);
na= sim(net,np);
b=postmnmx(na,minp,maxp)
然后在matlab上运行,提示出这样的错误“Error using ==> network.train
Inputs are incorrectly sized for network.
Matrix must have 1 rows.”
请问这是什么地方出错了啊?我看了很久也没看出来,提示说输入不对,至少要有一行,可我的输入不可能没有一行啊?
至少要有一行
must 是必须的意思 预处理有问题,修改一下
net=newff([-1,1;-1,1;-1,1;-1,1;-1,1;-1,1],,{'tansig','logsig','purelin'},'traingd');
[ 本帖最后由 happy 于 2007-2-1 22:54 编辑 ]
回复 #3 happy 的帖子
谢谢楼上,程序现在能运行了,是不是输入层有n个神经元建立网络时net=newff(PR,...)中就应该有n个PR矩阵啊?
页:
[1]