Solving systems of equations with "solve" function
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
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
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
2012 年 9 月 12 日
I was able to get somewhere useful in Maple by using the following approach:
- convert all floating-point quantities to rational numbers
- solve the first four equations for a, b, c, h
- substitute those values a, b, c, h into the remaining equations (#5 to #10)
- solve the (a,b,c,h)-substituted #5 and #6 for e and f
- substitute those values e, f, into the (a,b,c,h)-substituted #7 to #10
- solve the (a,b,c,h,e,f)-substituted #9 for o, and take the first of the two roots
- substitute that value o into the (a,b,c,h,e,f)-substituted #7, #8, #10
- 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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Equation Solving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!