Trying to do a Laplace transform on a discontinuous function
6 次查看(过去 30 天)
显示 更早的评论
I am trying to write code to solve g(t).
I rewrote the function as g(t) = 4 + 5*(t-2)*e^(t-2)*u(t-2).
In MATLAB,
syms t
oldVal = sympref("HeavisideAtOrigin",4);
eqn = 4 + 5*(t-2)*exp(t-2)*heaviside(t)
L = laplace(eqn)
Though this runs, it doesn't seem right to me.
What am I doing wrong?
1 个评论
回答(1 个)
Star Strider
2023-9-5
I initially wanted to see if piecewise would work. It didn’t.
This is the result I get using heaviside to define the areas of interest, and then combine them into one expression —
syms s t
g_1(t) = 4*(heaviside(t)-heaviside(sym(t-2)))
g_2(t) = heaviside(sym(t-2))*(4+5*(t-2)*exp(t-2))
G(s) = laplace(g_1) + laplace(g_2)
G(s) = simplify(G,500)
figure
fplot(g_1, [-1 5])
ylim([0 50])
title('g_1(t)')
figure
fplot(g_2, [-1 5])
ylim([0 50])
title('g_2(t)')
figure
fplot(g_1+g_2, [-1 5])
ylim([0 50])
title('g_1(t)+g_2(t)')
The time-domain function appears to be reasonable, so I assume the Laplace transform is as well.
.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!