can't solve an equation

2 views (last 30 days)
Amr Sadek
Amr Sadek on 29 Sep 2014
Commented: SK on 29 Sep 2014
Hello,
I'm trying to solve this equation:
Fun=@(T) 1-exp(-n.*S.*( integral(@(T) exp(-E./(k.*T)),Ti,T)) ) ;
Where E=1; k=8.6e-5; n=10; S=1e12; Ti=300;
For T=300:500, this function changes from Fun= [0:1]. So, this function has real values from 0 to 1 in this range of T. However, the matlab can solve this equation for only the values in the range of [0:0.49]. If, for example, Fun=0.5 or 0.6....0.99, the MATLAB gives: "Warning: Explicit solution could not be found."
Here is the details of my code:
The solution of the integral in the equation is given by:
(T.*exp(-E./(k.*T))- ( (E./k).*expint(E./(k.*T)) )) - (Ti.*exp(-E./(k.*Ti))- ( (E./k).*expint(E./(k.*Ti)) ))
So, the final form of the equation will be given as:
fun=1-exp(-n.*S.*( ((T.*exp(-E./(k.*T))- ( (E./k).*expint(E./(k.*T)) )) - (Ti.*exp(-E./(k.*Ti))- ( (E./k).*expint(E./(k.*Ti)) ))))) ;
Examples:
syms T
>> solve(fun==0.2)
ans =
345.05417496592632071516378454629
However,
solve(fun==0.5)
Warning: Explicit solution could not be found.
> In solve at 179
ans =
[ empty sym ]
can anyone help me in this?
Thank you

Accepted Answer

SK
SK on 29 Sep 2014
Maybe you need to specify a rough domain where the solution lies or a starting point for the iteration? The solver may not be looking at high enough values of T and so gets stuck at the halfway inflexion point. You may need to ask it to look at the entire interval say 0 to 500. I don't see an option in Matlab to do this but the docs say that you can do it in the Mupad notebook.

More Answers (1)

Amr Sadek
Amr Sadek on 29 Sep 2014
Edited: Amr Sadek on 29 Sep 2014
Thank you for your answer
I used the vpasolve built-in function instead of the "solve" function. This function allows me to use start point or searching region for the solution. I tested it and it worked very well.
Thank you.

Tags

Community Treasure Hunt

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

Start Hunting!