When I run a code it shows error using vertcat in the marked line. What does it mean and how to change it?
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);
A
was missing some spaces. This should work:
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.