Help with solving two equations set equal to each other

Hello,
I am having some trouble solving two separate equations for one variable between them. I thought I could input the two equations as a function separated by a semicolon and use fsolve to solve. The code so far is:
Na=6.022E23;
kb=1.381E-23;
Rg=Na*kb
Theta_E_alpha=160;
Fo_alpha=-38000;
Theta_E_beta=370;
Fo_beta=-61000;
x1=1; %Initial guess for solving (K)
fun1=@(T) [Fo_alpha+3*Rg*(T(1)*log(exp(Theta_E_alpha/T(1))-1));
Fo_beta+3*Rg*(T(1)*log(exp(Theta_E_beta/T(1))-1))];
X=fsolve(fun1,x1);
I want to solve for T common to both equations.
Can someone help, what am I missing? Thank you!
Mike

 採用された回答

Shashank Prasanna
Shashank Prasanna 2013 年 1 月 25 日
編集済み: Shashank Prasanna 2013 年 1 月 25 日

0 投票

Your current setup is forcing both the equations to zero individually. However if you intention is to solve for T such that equation_1 = equation_2 Then you can just subtract one from the other and call fsolve.
fun1=@(T) [Fo_alpha+3*Rg*(T(1)*log(exp(Theta_E_alpha/T(1))-1)) - Fo_beta-3*Rg*(T(1)*log(exp(Theta_E_beta/T(1))-1))]
X=fsolve(fun1,x1);

1 件のコメント

Mike
Mike 2013 年 1 月 25 日
Thank you for your answer, this is actually how I originally tried to solve the equations but I was unable to get it to converge on a solution...I tried another iterative program and was able to determine the answer to be ~950K. I think now my problem was the initial guess was too far off. I will go back and try to get this to converge in Matlab.
Thank you again.
Mike

サインインしてコメントする。

その他の回答 (1 件)

Roger Stafford
Roger Stafford 2013 年 1 月 25 日

0 投票

It is important to realize that ordinarily one cannot solve two simultaneous equations with only one unknown. It generally takes as many unknowns as equations. It is very likely that will be true in this case.
Think of it this way. Solving a single equation for an unknown amounts to finding the point on an x-axis where some function of x crosses that x-axis. How likely is it that two different functions will cross the x-axis at exactly the same point? There would have to be something very special about the functions for that to be true.

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by