How to solve laplace transform for ODE with initial value condition

23 views (last 30 days)
i have tried to solve this problem
with this code :
syms t y(t) Y(s) Dy0 a b y0
Dy1 = diff(y,t,1);
eqn = laplace(t*Dy1+ y == cos(t))
eqn = subs(eqn, {laplace(y(t), t, s), subs(diff(y(t), t), t, 0), y(0)},{Y(s), 0, 2})
eqn = isolate(eqn, Y)
but it did not work, i may used the code in improperr way but i am pretty sure that the prob. has an answer not as matlap programm responde that the equation has no solution..
any help i will apretiate

Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 15 Nov 2021
Here is the corrected code:
syms t s y(t) Y(s)
Dy = diff(y,t);
EQN = t*Dy+y== cos(t);
LT = laplace(EQN, t, s);
LT = subs(LT, {laplace(y(t), t, s), y(0)},{Y(0), 2})
LT = 
Y = solve(LT, Y)
Warning: Unable to find explicit solution. For options, see help.
Y = Empty sym: 0-by-1
disp('Solution is: ')
Solution is:
SOL = ilaplace(Y)
SOL = Empty sym: 0-by-1
pretty(SOL)
()
% It does not have an analytical solution:
syms t y(t)
Dy = diff(y,t);
EQN = t*Dy+y== cos(t);
SOL = dsolve(EQN, y(0)==2)
Warning: Unable to find symbolic solution.
SOL = [ empty sym ]

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!