Tuesday, May 19, 2015

Matlab code to solve the 2nd order differential equation y''-2y'-3y=3*t^2+4*t-5

close all;

clc;

%% Solve the 2nd order differential equation y''-2y'-3y=3*t^2+4*t-5

%% y' can be represented using 'D' or diff and y'' can be represented using 'D2y'
%% For 2nd order differential equation provide 2 initial condition


y=dsolve('D2y-2*Dy-3*y=3*t^2+4*t-5','y(0)=1','Dy(0)=2','t')

%% Make Y pretty

pretty(y)

%% Plot the expression at diffrent value of x

%% ezplot-> y is a function with respect to x

%% only plot --> x and y has some values

ezplot(y,[0 50])

No comments:

Post a Comment