Help with for loop for a matrix and lb,ub.

We have this code but troubles in the for-loops(described in the for loop):
f = [214 ; 91 ; 135 ; 260 ; 340 ; 125];
A = [-1 -1 -1 -1 -1 -1];
lb = [720, 432, 336, 216, 0, 120];
ub = [1800, 1080, 840, 720, 360, 480];
[x,fval,exitflag,output,lambda] = linprog(f,A,b,[],[],lb,ub)
out=[];
A = -out;
load varmelast.txt
bjan = varmelast(5:11);
bjan_tot = mean(bjan);
for i = 1:64
if *%we need to write here that when there's a 0 in the matrix, lb and ub should also b zero. But How?*
else *%and here, otherwise lb and ub are as written above. How do we do this?*********
end
We also want to have several numbers in b, and want the matrix to run through all the b-values. We're guessing we need another for-loop but don't know how to do it. We need your help!! %behöver också kod för att köra hela A-matrisen för ALLA b-värden

1 Comment

The question is not clear. You are searching for "a 0 in the matrix" - in which matrix? lb cannot be zero, because it is a vector. Do you mean, that the element lb(i) is 0?

Sign in to comment.

Answers (0)

Categories

Asked:

on 3 Mar 2016

Commented:

Jan
on 3 Mar 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!