Using ilaplace function i get answer in terms of ilaplace but i need it in terms of a variable t:
Show older comments
This is my code:
clc;
clear;
syms t y(t) s Y
Dy=diff(y,t); D2y=diff(Dy,t);
F=input("Enter coefficients of [y'' y' y]");
a=F(1);b=F(2);c=F(3);
nh=input('Enter the RHS function f(t)');
eqn=a*D2y+b*Dy+c*y-nh;
LTY=laplace(eqn,t,s);
IC=input("enter initial conditions [y0,y0']");
y0=IC(1);dy0=IC(2);
LTY=subs(LTY,laplace(y(t),t,s),Y);
LTY=subs(LTY,y(0),y0);
LTY=subs(LTY,subs(diff(y(t),t),t,0),dy0);
YS=solve(LTY,Y);
y=ilaplace(YS,s,t)
And when i enter the input:
[1 0 1]
3*(1-heaviside(t-4))+(2*t-5)*heaviside(t-4)
[1,0]
I get the output as
y =
2*ilaplace(1/(s^2*exp(4*s) + s^4*exp(4*s)), s, t) - 2*cos(t) + 3
how to get replace ilaplace in the answer with actual answer as function of t?
Accepted Answer
More Answers (0)
Categories
Find more on Calculus 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!
