Issue with Laplace Transform for Exponential Functions in MATLAB

3 visualizaciones (últimos 30 días)
FFU
FFU el 1 de Abr. de 2025
Comentada: Paul el 1 de Abr. de 2025
Hello everyone,
I'm encountering an issue while trying to compute the Laplace transform of exponential functions in MATLAB using the laplace command. Specifically, when I input an exponential function directly (e.g., f = 2^(-t)), the command does not return a meaningful result. However, if I rewrite the exponential function using the exp function (e.g., exp(-log(2)*t)), the Laplace transform works as expected.
Could someone explain why this discrepancy occurs? Is there a specific syntax or method I should follow to ensure that MATLAB computes the Laplace transform of exponential functions directly, without needing to use exp?
Interestingly, if f = exp(1)^(-t), the laplace command does not work either.
syms t real
f1 = 2^(-t);
f2 = exp(-log(2)*t);
f3 = exp(1)^(-t);
f4 = exp(-t);
F1 = laplace(f1)
F1 = 
F2 = laplace(f2)
F2 = 
F3 = laplace(f3)
F3 = 
F4 = laplace(f4)
F4 = 
I've found some discussion online about this issue, but it wasn't particularly helpful. Here's the link to what I found: MathWorks Discussion.
Thanks in advance for your help!

Respuesta aceptada

Paul
Paul el 1 de Abr. de 2025
Hi FFU,
Let's take a look at these one by one.
syms t real
f1 = 2^(-t);
I've never seen a Laplace transform table that includes an explicit entry for this form of a function, but I'd like to. Maybe that's why laplace fails?
F1 = laplace(f1)
F1 = 
But we can do
F1 = laplace(rewrite(f1,'exp'))
F1 = 
f2 = exp(-log(2)*t);
f2(t) is just a form for exp(-a*t), which has transform F2(s) = 1/(s + a), which laplace handles easily.
laplace(f2)
ans = 
Note that log(2) is being approximated in floating point and then expressed as a rational number on conversion to sym. It might be more clear to say
f2 = exp(-log(sym(2))*t)
f2 = 
then
F2 = laplace(f2)
F2 = 
Turning to f3
f3 = exp(1)^(-t)
f3 = 
Again, exp(1) is being evaluated in floating point with numeric exp, so not exactly equal to e, and then converted to a sym rational expression. So now we are back to the same situation as for f1, i.e., a function of the form a^(-t) (with a ~= e)
laplace(f3)
ans = 
laplace(rewrite(f3,'exp'))
ans = 
Putting sym on the inside uses the symbolic function exp (which, amazingly, doesn't have its own doc page I don't believe)
f3 = exp(sym(1))^(-t)
f3 = 
which works fine
laplace(f3)
ans = 
and is, of course, the same as f4
f4 = exp(-t);
laplace(f4)
ans = 
  2 comentarios
FFU
FFU el 1 de Abr. de 2025

The way the exponential function is handled feels somewhat cumbersome, especially when compared to other symbolic math software.What do you think?

Paul
Paul el 1 de Abr. de 2025
If by "exponential function" you mean functions of the form of f1, I do find it curious I can't find such a function in Laplace trasnsform tables. That is, why don't the tables include an entry for the general case with whatever limitations may apply to a and b (should there be any)?
syms t real
syms a b
f1 = a^(b*t);
laplace(rewrite(f1,'exp'))
ans = 
Maybe it's just expected that one can rewrite f1 in terms of exp so that there's no need for an additional table entry.
I'm not familar with any other symbolic math software, so can't comment on that. If you think Matlab should handle f1 better, you can always submit an Enhancement Request to Tech Support.

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by