Solving systems of equations with "solve" function

조회 수: 1 (최근 30일)
Niki
Niki 2012년 9월 12일
Tried to follow the mathworks help page here http://www.mathworks.com/help/symbolic/solve.html to solve this chemical engineering problem but I can't seem to get it to work right...
what I have is a system of 10 equations and 10 unknowns. Is there any way to get an explicit answer? I can stand a bit if error in the figures, as they will turn out to be non-integers.
any help would be greatly appreciated :)
I input this:
>> r=8.314
>> t=773.15
>>rt=r*t
>> syms a b c d e f h o g n
>> s = solve((-12128.6/rt)+log(a/n)+(g/rt)+(4*h/rt), ...
(-179617/rt)+log(b/n)+(g/rt)+(o/rt), ...
(-395713/rt)+log(c/n)+(g/rt)+(2*o/rt), ...
(-207482/rt)+(2*h/rt)+(o/rt), ...
log(e/n)+(2*h/rt), ...
log(f/n)+(2*o/rt), ...
a+b+c-1, 4*a+2*e-6, ...
b+2*c+2*f-1, ...
n-a+b+c+d+e+f)
Warning: Explicit solution could not be found. > In solve at 140 In sym.solve at 49 s = [ empty sym ]
  댓글 수: 1
Star Strider
Star Strider 2012년 9월 12일
What were the original equations?
What variables are you solving for?

댓글을 달려면 로그인하십시오.

답변 (2개)

Babak
Babak 2012년 9월 12일
Check the format of how to use "solve":
you should choose a variable to solve it for...Here all your variables a b c d e f h o g n are unknown and you are not determining what is supposed to be solved as a function of the others. To do that use solve format of
S = solve(eqn,var,Name,Value)
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 9월 12일
It is okay there are 10 equations in 10 unknowns, so solve() will solve for all of the variables simultaneously.

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2012년 9월 12일
I was able to get somewhere useful in Maple by using the following approach:
  1. convert all floating-point quantities to rational numbers
  2. solve the first four equations for a, b, c, h
  3. substitute those values a, b, c, h into the remaining equations (#5 to #10)
  4. solve the (a,b,c,h)-substituted #5 and #6 for e and f
  5. substitute those values e, f, into the (a,b,c,h)-substituted #7 to #10
  6. solve the (a,b,c,h,e,f)-substituted #9 for o, and take the first of the two roots
  7. substitute that value o into the (a,b,c,h,e,f)-substituted #7, #8, #10
  8. solve the (a,b,c,h,e,f,o)-substituted #7 for n (and simplify)
At this point n is the roots of a 4th order polynomial whose terms involve exponentials and g, and d is trivial to find as the negative of the sum of some of the other variables. The only variable left to pin down at this point is g. You can proceed to substitute n into (a,b,c,h,e,f,o)-substituted #8 and try to solve for g. It is likely that the result would either be too complicated to solve algebraically or would take a long time to solve, so you might want to switch to numeric solutions at this point.

카테고리

Help CenterFile Exchange에서 Equation Solving에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by