MATLAB: How to optimise five equations and four unknowns

constraintsoptimisationsimultaneous equation

Hi, I am looking to find the optimal power output for four generators given the equations and conditions:
0.31246×1 + 0.15×2 + 0.15×3 + 0.15×4 = 46,
0.15×1 + 0.3×2 + 0.15×3 + 0.15×4 = 40,
0.15×1 + 0.15×2 + 0.3×3 + 0.15×4 = 55,
0.15×1 + 0.15×2 + 0.15×3 + 0.3×4 = 50.5,
x1+x2+x3+x4=200
25<=x1<=100
5.5<=x2<=30
20<=x3<=130
25.5<=x4<=160
To maximise x1, x2, x3 and x4.
Please help.

Best Answer

You have five equations in four unknowns, which means that you probably have no solution to your problem as stated. Consider solving the first four equations:
A = [0.31246 0.15 0.15 0.15
0.15 0.3 0.15 0.15
0.15 0.15 0.3 0.15
0.15 0.15 0.15 0.3 ];
b = [46
40
55
50.5];
c = A\b
c =
48.1346
12.1330
112.1330
82.1330
sum(c)
ans =
254.5337
So you cannot satisfy all of your equations. What would you like to do? Find a least-squares solution? Something else?
Here is a least-squares solution:
A = [A;1 1 1 1];
b = [b;200];
c = A \ b
c =
40.1980
-1.1451
98.8549
68.8549
sum(c)
ans =
206.7627
Alan Weiss
MATLAB mathematical toolbox documentation