Solving a system of 7 equations with solve is producing empty solutions, any ideas?
Show older comments
Here is what I had. The issue is that it won't find the solution for each LoLo A1 L1 gp1 gp2 g1 g2 but rather returns an empty response for each. No errors came up- the solution sol is just empty.
R=8.314; %gas constant (J/(Kmol))
T=1573.15; %isothermal hold T (K)
A2=(1-2*0.925)-(1-2*0.16);
A3=(6*0.925^2-6*0.925+1)-(6*0.16^2-6*0.16+1);
syms Lo A1 L1 gp1 gp2 g1 g2 ;
equ1=(g1-gp1*0.16)-(g2-gp2*0.925);
equ2=R*T*(log(0.16)-log(1-0.16))-R*T*(log(0.925)-log(1-0.925))-A1;
equ3=(A2*Lo-A1)/A3-L1; equ4=R*T*(log(0.16)-log(1-0.16))+Lo*(1-2*0.16)-L1*(6*0.16^2-6*0.16+1)-gp1;
equ5=R*T*(log(0.925)-log(1-0.925))+Lo*(1-2*0.925)-L1*(6*0.925^2-6*0.925+1)-gp2;
equ6=0.16*(1-0.16)*(Lo+L1*(2*0.16-1))+R*T*(0.16*log(0.16)+(1-0.16)*log(1-0.16))-g1;
equ7=0.925*(1-0.925)*(Lo+L1*(2*0.925-1))+R*T*(0.925*log(0.925)+(1-0.925)*log(1-0.925))-g2;
sol=solve(equ1,equ2,equ3,equ4,equ5,equ6,equ7);
Accepted Answer
More Answers (1)
Roger Stafford
on 26 Nov 2013
0 votes
Those equations are all linear in the seven unknowns, and there is no reason 'solve' shouldn't be able to solve them very easily. You could actually have used matrix division for solving them.
Have you tried specifying the unknowns in your call to 'solve'? That may be the trouble - 'solve' doesn't know which are the unknowns to solve for.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!