필터 지우기
필터 지우기

Trying to do a Laplace transform on a discontinuous function

조회 수: 2 (최근 30일)
Emily Friedman
Emily Friedman 2023년 9월 5일
편집: Paul 2023년 9월 5일
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)
eqn = 
L = laplace(eqn)
L = 
Though this runs, it doesn't seem right to me.
What am I doing wrong?
  댓글 수: 1
Paul
Paul 2023년 9월 5일
편집: Paul 2023년 9월 5일
Recheck the code for eqn. It doesn't match how g(t) was rewritten.
Also, the sympref isn't really necessary. Try different values of HeavisideAtOrigin and see if you get different results for L.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
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_1(t) = 
g_2(t) = heaviside(sym(t-2))*(4+5*(t-2)*exp(t-2))
g_2(t) = 
G(s) = laplace(g_1) + laplace(g_2)
G(s) = 
G(s) = simplify(G,500)
G(s) = 
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.
.

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by