Pathhacker

0 108 0
MATLAB code to solve second order differential equations using laplace transform

MATLAB code to solve and visualize solutions of the second order differential equations using Laplace transform

Clc
Clear all
Syms t s Y
y2=diff(sym(‘y(t)’),2);
y1=diff(sym(‘y(t)’),1);
y0=sym(‘y(t)’);
a=input(‘the coefficientt of D2y=’);
b=input=(‘The coefficient  of Dy=’);
c=input(‘The coefficient of y=’);
nh=input(‘Enter the non homogeneous part=’);
Eqn=a*y2+b*y1+c*y0-nh;
LTY=laplace(eqn,t,s);
If(a==0)
D=input(‘The initial value at 0 is ‘);
LTY=subs(LTY,{‘laplace (y(t),t,s)’,y(0)’},{Y,d})
Else
d=input(‘The initial vlue at 0 is ‘);
e=input(‘The initial value at 0 is ‘);
LTY=subs(LTY,{‘laplace(y(t),t,s)’,’y(0)’,’D(y)(0)’},{Y,d,e})
End
Eq=collect(LTY,Y);
Y=simplify(‘solve(eq,Y));
y=simplify(ilaplace(Y,s,t))
ezplot(y)


Tags

MATLAB code to solve the differential equational MATLAB code to solve the differential equation is clc clear…
Profile photo of Madhu by Madhu
0 119 0
MATLAB code to visualize 2D vector field MATLAB code to visualize 2D vector field Syms x y…
Profile photo of Madhu by Madhu
0 114 0
Matlab code for Generation of unit ramp sequence %------------Generation of unit ramp sequence------------- a=input('Enter desired length of the…
Profile photo of Madhu by Madhu
0 108 0
Your nameYour emailYour text

Leave a Reply

Log in
Register
Send message