MATLAB Answers

How to find the exact answer of an exponential equation?

11 views (last 30 days)
Yen Tien Yap
Yen Tien Yap on 16 Apr 2021
Edited: John D'Errico on 24 Sep 2021 at 15:27
syms t
solve(exp(-0.04*t)+exp(-0.12*t)==1,t)
I got the answer for this but I don't understand what it meant? I need a time value for this. Can someone explain me what this happened and how to get the exact value of t?
25*log(root(z^3 - z^2 - 1, z, 1))
Thank you so much!!

Answers (2)

Rik
Rik on 16 Apr 2021
You can use double to extract a numerical value, but if you're looking for a time, something is going wrong here. The numerical approach shows there actually is a solution.
syms t
solve((exp(-0.04*t)+exp(-0.12*t))==1,t), double(ans)
ans = 
ans = -4.7781 - 46.4120i
f=@(t) exp(-0.04*t)+exp(-0.12*t);
sol_t=fminsearch(@(t) abs(f(t)-1),10), f(sol_t)
sol_t = 9.5562
ans = 1.0000

John D'Errico
John D'Errico on 24 Sep 2021 at 15:26
Edited: John D'Errico on 24 Sep 2021 at 15:27
syms t real
Eqn = exp(-0.04*t)+exp(-0.12*t) - 1;
Write it like that. I did so because now we can plot it. See that I specified t to be a real variable, since you are not interested in complex valued solutions.
Now, we can plot it. Does a solution exist? Are there multiple solutions? ALWAYS PLOT EVERYTHING. Look at what you see. Think about what you see. Then plot it in a different way if necessary. Where this relationship crosses zero, this is your solution.
fplot(Eqn,[-5,25])
yline(0)
grid on
So a solution does exist, and I would bet there is only one real solution. The one you care about is a little less than 10.
tsol = solve(Eqn,t)
tsol = 
And that may not seem terribly useful, but it is. The result is the third root of a cubic polynomial, You need to push MATLAB to resolve the solution. VPA will do that here.
vpa(tsol)
ans = 
9.5561271460008910332339624796214
You could also have gone directly to a numerical solution using vpasolve.
vpasolve(Eqn)
ans = 
9.5561271460008910332339624796214
In fact, that polynomial had three roots, but two will yield complex values. If you wish an algebraic solution for the problem, you could do this:
solve(Eqn,t,'maxdegree',3)
ans = 

Community Treasure Hunt

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

Start Hunting!