Matrix dimensions must agree.
问题描述:
Matrix dimensions must agree.
x1=data(:,2);
x2=data(:,3);
x3=data(:,4);
x4=data(:,5);
x5=data(:,6);
x6=data(:,7);
x7=data(:,8);
x8=data(:,9);
x9=data(:,10);
y=data(:,11);
input_train=[x1,x2,x3,x4,x5,x6,x7,x8,x9];
output_train=[y];
minp=min(input_train);
maxp=max(input_train);
mint=min(output_train);
maxt=max(output_train);
pn=2*(input_train-minp)/(maxp-minp)-1;
tn=2*(output_train-mint)/(maxt-mint)-1;
结果报错
Error using ==> minus
Matrix dimensions must agree.
Error in ==> rbf1 at 17
pn=2*(input_train-minp)/(maxp-minp);
我觉得矩阵的维度是一致的呀.可以相减
答
Matrix dimensions must agree.是说矩阵维度不匹配.如果你的minp,maxp 都是一个数的话,那就是pcs这个参数的维度有问题.你把pcs从工作空间里调出来,即用鼠标双击workspace 里的pcs,看它里面是否有NAN?我也遇到过这种...