How to solve laplace transform for ODE with initial value condition
Show older comments
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)
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})
Y = solve(LT, Y)
disp('Solution is: ')
SOL = ilaplace(Y)
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)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!