F1 + F2 + F3 + F4 + F5 + F6 = 9810; -F1*0.52 - F2*0.52 + F3*0.3 + F4*0.3 + F5*0.64 + F6*0.64 = 0 (F1 + F3 + F5)*(0.94) - (F2 + F4 + F6)*(0.74) = 0
I want to solve this underdetermined system of equations and add a constrain for all values must be higher than zero.I don't want to any of value equal to or less than zero.
I tried in matlab with lsqnonneg function and some of values are zero.Here is the code:
A = [1 1 1 1 1 1;-0.52 -0.52 0.3 0.3 0.64 0.64;0.94 -0.74 0.94 -0.74 0.94 -0.74];
b = [9810;0;0];
x = lsqnonneg(A,b)
Also I tried this code but this code doesn't give me any solution.
syms F1 F2 F3 F4 F5 F6
eq1 = F1 + F2 + F3 + F4 + F5 + F6 == 9810;
eq2 = -F1*0.52 - F2*0.52 + F3*0.3 + F4*0.3 + F5*0.64 + F6*0.64 == 0;
eq3 = (F1 + F3 + F5)*(0.94) - (F2 + F4 + F6)*(0.74) == 0;
lb = [F1, F2, F3, F4, F5, F6] > 0;
sol = solve([eq1, eq2, eq3, lb],[F1,F2,F3,F4,F5,F6]);
sol.F1
sol.F2
sol.F3
sol.F4
sol.F5
sol.F6
A well-known approach is to formulate this as an LP (Linear Programming) problem with a dummy objective (e.g. 0) and lower bounds something like 0.0001. Definitely don't use something like 0.0000001 as there are feasibility tolerances in play (which can be as big as 1e-4 and can be further amplified by scaling). I would use a number that is a few orders of magnitude larger than the feasibility tolerance.