MATLAB: Solving for 4 unknowns

solvesyms

I am solving for L, V, x1, and y1, but I'm getting very large fractions that are incorrect. What should I change to have MATLAB output an actual answer for each? Thanks.
x1 and y1 are mole fractions, meaning they should be less than 1. V and L are vapor and liquid streams, which have units of mol/s. The values shouldn't be greater than 3 mol/s.
P1 = 124.13; %mmHg


P2 = 483.53; %mmHg
P = 300; %mmHg
N = 2.15; %mol/s
w = 0.5;
syms L V x1 y1
eq1 = N-L-V;
eq2 = (w*N)-(x1*L)-(y1*V);
eq3 = (x1*P1)-(y1*P);
eq4 = ((1-x1)*P1)-((1-y1)*P2);
sol = solve(eq1,eq2,eq3,eq4)
disp(sol.L)
disp(sol.V)
disp(sol.x1)
disp(sol.y1)

Best Answer

Why do these not look like actual solutions to the equation system?
subs(eq1,{L,V,x1,y1},[1.86, 0.29, 0.537, 0.258])
ans =
0
>> subs(eq2,{L,V,x1,y1},[1.86, 0.29, 0.537, 0.258])
ans =
17/12500
>> subs(eq3,{L,V,x1,y1},[1.86, 0.29, 0.537, 0.258])
ans =
-1074219/100000
>> subs(eq4,{L,V,x1,y1},[1.86, 0.29, 0.537, 0.258])
ans =
-30130707/100000
In the last two equations, the result seems pretty significantly non-zero, not even remotely close.
So while you may think you know the solution to that system, you clearly do not.
What should you change? Well, either find what you did wrong when you wrote the equations, or recognize that the numbers you think are solutions are not that. The system is in fact, darn near linear in the unknowns. I could probably solve it by hand. (Lets see, eq3 and eq4 are linear in the unknnowns x1 and y1. So we can solve them independently for x1 and y1. Once you know x1 and y1, then eq1 and eq2 are again a linear 2x2 system of equations in the unknowns L and V. (Case closed, trivial. Pencil and paper will suffice.)
But if I let MATLAB do the job itself, then we get what is a solution. Since the problem ends up being linear in the end, the solution will be unique too, as long as the equations are not degenerate. (They appear not to be so.)
sol = solve(eq1,eq2,eq3,eq4)
sol =
struct with fields:
L: [1×1 sym]
V: [1×1 sym]
x1: [1×1 sym]
y1: [1×1 sym]
>> subs(eq1,sol)
ans =
0
>> subs(eq2,sol)
ans =
0
>> subs(eq3,sol)
ans =
0
>> subs(eq4,sol)
ans =
0
You may not like it, but there is a phrase that may apply here: garbage in, garbage out.