Root of exponential function not complete
11 views (last 30 days)
Show older comments
I am trying to find the roots of the equation
exp(-0.5*x)-0.4/(1+0.5*x)
and with the following code, only one of the 2 roots is found:
syms x
eq1=exp(-0.5*x)-0.4/(1+0.5*x)==0;
sol=solve(eq1,x);
vpa(sol,6)
ans =
-1.64929
But there is another root of this equation which is found using the fzero command
eq1=@(x) exp(-0.5*x)-0.4/(1+0.5*x);
sol=fzero(eq1,[-10 10]);
vpa(sol,6)
ans =4.04463
Again the given solution is only one of the 2. How can I get both of them at any time with one command? Thanks
0 Comments
Answers (1)
madhan ravi
on 28 Oct 2018
Edited: madhan ravi
on 28 Oct 2018
syms x
eq1=exp(-0.5*x)-0.4/(1+0.5*x)==0;
fplot(exp(-0.5*x)-0.4/(1+0.5*x)) %always compare the result with the graph
solution1=vpasolve(eq1,x,[-2 0])
solution2=vpasolve(eq1,x,[0 5])
grid on
7 Comments
madhan ravi
on 28 Oct 2018
Yes I know even I have thought about it ;) but yet no discernible idea in my mind though
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!