Solving equations using Laplace transform

조회 수: 45 (최근 30일)
Aleem Andrew
Aleem Andrew 2021년 1월 14일
답변: Logeshwari S 2021년 11월 19일
I am trying to solve an equation using the Laplace transform without having to find the Laplace transforms of the terms in the equation. Matlab is unable to find a solution based on the code below, although a solution can be found by writing the terms as a function of s. Could someone please suggest a method to do this?
syms y(t)
Dy2 = diff(y,t,2); Dy1 = diff(y,t,1);
eqn = laplace(Dy2+3*Dy1+2*y) == laplace(exp(-t))
cond = [y(0)==4, Dy(0)==5];
sol = dsolve(eqn,cond)
f

채택된 답변

Star Strider
Star Strider 2021년 1월 14일
Unless you are solving a partial differential equation, such that the Laplace transform produces an ordinary differential equation in one of the two variables and a Laplace transform of ‘t’, dsolve is not appropriate. It is simply necessary to solve for (in this instance) ‘Y(s)’ and then invert it to get ‘y(t)’:
syms t y(t) Y(s) Dy0
Dy2 = diff(y,t,2);
Dy1 = diff(y,t,1);
eqn = laplace(Dy2+3*Dy1+2*y == exp(-t))
eqn = subs(eqn, {laplace(y(t), t, s), subs(diff(y(t), t), t, 0)},{Y(s), Dy0})
cond = [y(0)==4, Dy1(0)==5];
Soln_s = isolate(eqn, Y(s))
Soln_t = ilaplace(Soln_s)
Soln_t = subs(Soln_t, {ilaplace(Y(s), s, t)}, {y(t)})
Soln_t = simplify(Soln_t, 'Steps',500)
.
  댓글 수: 6
Aleem Andrew
Aleem Andrew 2021년 1월 14일
Thank you. You have been very helpful
Star Strider
Star Strider 2021년 1월 14일
As always, my pleasure!

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

추가 답변 (1개)

Logeshwari S
Logeshwari S 2021년 11월 19일
clear all clc syms x w f=input('Enter the function of x: '); F=laplace(f,x,w); disp('Laplace transform of f(t) = '); disp(F);

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by