Sunday, May 17, 2015

MatLab code to solve 1st order differential equation dy/dx=2+x^2-y

In First order differential equation, order of the equation is 1




Example Program :

%% Solve the 1st order differential equation dy/dx=2+x^2-y

%% dy/dx can be represented using 'D' or diff 

%% y(0)=1 is the initial condition 

y=dsolve('Dy+y=2+(x^2)','y(0)=5','x')

%% 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 5])

No comments:

Post a Comment