Solving a system of 7 equations with solve is producing empty solutions, any ideas?
2 views (last 30 days)
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);
0 Comments
Accepted Answer
Walter Roberson
on 26 Nov 2013
It is capable of solution, at least if you switch to rational values. The solution set is
g2 = (343589772257/5618160000) * ln(4/25) + (2143806607181/1872720000) * ln(21/25) + (21133190640089/1755675000) * ln(37/40) - (95870309503/585225000) * ln(3/40)
g1 = -(919857962803/877837500) * ln(4/25) + (12238047735179/1170450000) * ln(21/25) + (3446099474468/1097296875) * ln(37/40) + (194094869444/365765625) * ln(3/40)
gp2 = (150541236341/33379500) * ln(4/25) - (3258413397883/76296000) * ln(21/25) + (14648669392/5960625) * ln(37/40) - (14648669392/5960625) * ln(3/40) + (45875/15708) * g1
gp1 = gp2
Lo = -(61079719697/4492080) * ln(4/25) + (61079719697/4492080) * ln(21/25) + (31651589222/7018875) * ln(37/40) - (31651589222/7018875) * ln(3/40) + (255/367) * gp1
L1 = -(200/51) * Lo - (261583382/7803) * ln(4/25) + (261583382/7803) * ln(21/25) + (261583382/7803) * ln(37/40) - (261583382/7803) * ln(3/40)
A1 = (130791691/10000) * ln(4/25) - (130791691/10000) * ln(21/25) - (130791691/10000) * ln(37/40) + (130791691/10000) * ln(3/40)
More Answers (1)
Roger Stafford
on 26 Nov 2013
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.
See Also
Categories
Find more on Linear Algebra 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!