[已答复] 错误使用 vertcat 要串联的数组的维度不一致,怎么解决呀,求大神帮帮忙

[复制链接]
despacitoooo 发表于 2022-6-17 23:49:48
本帖最后由 despacitoooo 于 2022-6-17 23:51 编辑

r1=0.018;r2=0.01944;r3=0.0216;r5=0.02304;M=5000;
f=zeros(34,1);f(34,1)=-10;
Aeq=[1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
-(1+r1),0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1;
0,-(1+2*r2),0,0,-(1+r1),0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1;
0,0,-(1+3*r3),0,0,-(1+2*r2),0,0,-(1+r1),0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1;
0,0,0,0,0,0,-(1+3*r3),0,0,-(1+2*r2),0,0,-(1+r1),0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1;
0,0,0,-(1+5*r5),0,0,0,0,0,0,-(1+3*r3),0,0,-(1+2*r2),0,0,-(1+r1),0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1;
0,0,0,0,0,0,0,-(1+5*r5),0,0,0,0,0,0,-(1+3*r3),0,0,-(1+2*r2),0,0,-(1+r1),0,0,0,1,1,1,0,0,0,0,0,0,1;
0,0,0,0,0,0,0,0,0,0,0,-(1+5*r5),0,0,0,0,0,0,-(1+3*r3),0,0,-(1+2*r2),0,0,-(1+r1),0,0,1,1,1,0,0,0,1;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-(1+5*r5),0,0,0,0,0,0,-(1+3*r3),0,0,-(1+2*r2),0,-(1+r1),0,0,1,1,0,1;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-(1+5*r5),0,0,0,0,0,0,-(1+3*r3),0,-(1+2*r2),0.-(1+r1),0,1,1;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-(1+5*r5),0,0,0,0,0,-(1+3*r3),0,-(1+2*r2),(1+r1),1];
beq= zeros(11,1); beq(1,1) = M;beq(11,1)=-M;
lb=zeros(34,1);
[x,fval] = linprog(f,[],[],Aeq, beq, lb);用matlab运行结果如下:
错误使用 vertcat
要串联的数组的维度不一致。

出错 Untitled4 (line 3)
Aeq=[1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;

2 条回复


TouAkira 发表于 2022-6-18 08:11:32
这么简单个事,自己就检查不出来?
Aeq 其他行都是34个元素,只有倒数第二行是33个元素,缺了1个,不匹配。

despacitoooo 发表于 2022-6-18 22:07:30
TouAkira 发表于 2022-6-18 08:11
这么简单个事,自己就检查不出来?
Aeq 其他行都是34个元素,只有倒数第二行是33个元素,缺了1个,不匹配。 ...

谢谢谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

相关帖子
相关文章
热门教程
站长推荐
快速回复 返回顶部 返回列表