MATLAB: Cant use linprog for maximize

linprog maximize codeMATLAB

I have my function fx= -0.818×1 + 0.241×2 + 4.737×3 + 0.2×4 + 0.483×5 – 0.02×6 + 0.06×7. And I have some constrains: 1. fx cant be larger than 100
2. 22=<x1=<40
3. 52=<x2=<80
4. 3.5=<x3=<5.9
5. 12=<x4=<22
6. 105=<x5=<150
7. 300=<x6=<700
8. 800=<x7=<1200
9. x4+x3=21
10. x5-x2=50
Please, show me the code of this optimization.

Best Answer

Isn't this basically the same question you asked before? You have added a couple of equality constraints only.
I won't even bother to copy over the rest of your code from your last question. Just pass in these additional two variables now into linprog (where you previously passed in [] as placeholders when you had no equality constraints.)
Aeq = [0 0 1 1 0 0 0;0 -1 0 0 1 0 0];
beq = [21;50];