0

当我运行代码时,它在标记行中使用 vertcat 显示错误。它是什么意思以及如何改变它?

f = [-10 -20 -40 -10 -10 80 70 90];  
A = [ 1 1 2 1 3 0 0 0 -----> vertcat error
      2 1 3 2 2 0 0 0 
      1 2 1 1 0 0 0 0
     -1 0 0 0 0 1 1 1 
      0-1 0 0 0 1 1 1
      0 0-1 0 0 1 0 0 
      0 0 0-1 0 0 1 0
      0 0 0 0-1 0 0 1];

b  = [800 600 900 0 0 0 0 0]; 
ub = [inf inf inf inf inf 90 57 93]; 
lb = zeros(8,1); 
[x fval]=linprog(-f,A,b,[],[],lb,ub);
4

1 回答 1

1

A缺少一些空格。这应该有效:

A = [ 1 1 2 1 3 0 0 0;
      2 1 3 2 2 0 0 0;
      1 2 1 1 0 0 0 0;
      -1 0 0 0 0 1 1 1;
      0 -1 0 0 0 1 1 1;
      0 0 -1 0 0 1 0 0;
      0 0 0 -1 0 0 1 0;
      0 0 0 0 -1 0 0 1]

A =

     1     1     2     1     3     0     0     0
     2     1     3     2     2     0     0     0
     1     2     1     1     0     0     0     0
    -1     0     0     0     0     1     1     1
     0    -1     0     0     0     1     1     1
     0     0    -1     0     0     1     0     0
     0     0     0    -1     0     0     1     0
     0     0     0     0    -1     0     0     1
于 2013-04-13T00:54:38.647 回答