Help with solving two equations set equal to each other

7 views (last 30 days)
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

Accepted Answer

Shashank Prasanna
Shashank Prasanna on 25 Jan 2013
Edited: Shashank Prasanna on 25 Jan 2013
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 Comment
Mike
Mike on 25 Jan 2013
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

Sign in to comment.

More Answers (1)

Roger Stafford
Roger Stafford on 25 Jan 2013
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.

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!