How to Use 'linprog' ?

5 views (last 30 days)
Asanga
Asanga on 30 Sep 2014
Hello! I have a objective function similar to following,
constraints
1. x1(t) and x2(t) are know from 1 to 24.
2. x3(t),x4(t) >= 0
3. if x3(t) > 0, x4(t) = 0
4. if x4(t) > 0, x3(t) = 0
5. z(t+1) = z(t) + a*x3(t) - a*x4(t) ; z(1)=0
6. 0 <= z(t) <=1
I tried 'linprog' to solve this problem. I used two matrices containing x1(t) and x2(t) data and tried to use a 'for' loop to solve this problem.
Also, I tried to use 'if' statement for constraint 3,4,5,6. But still I am getting errors and unrealastic answers.
Can I use for loop, if, etc to create constraints while using [x,fval] = linprog (f,A,b,Aeq,beq)
Thanks

Answers (0)

Community Treasure Hunt

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

Start Hunting!