Professional Documents
Culture Documents
AE610a Assignment: Matlab Code For Solving The Above Ode Using Ode45 Solver
AE610a Assignment: Matlab Code For Solving The Above Ode Using Ode45 Solver
Assignment
Submitted by : Nimish Kumar(11467)
Q. Solve 3
rd
order differential equation f+0.5ff=0
Initial conditions:- f(0)=0
f(0)=0
f(0)=0.332
Solution:
Let
y1=f
y2=f
y3=f
Now differentiate each above equation
y1=y2
y2=y3
y3=0.5*y1*y2
MATLAB CODE FOR SOLVING THE ABOVE ODE USING ode45 SOLVER:
% Function for finding the derivatives in matrix form
function dydx= ode3ord(x,y)
dydx=[y(2)
y(3)
-0.5*y(1)*y(2)];
% Function for ode solver using ode45
function [T,Y] = TB(t0,tf,f0,fdot0,fdotdot0)
[T,Y] = ode45('ode3ord',[t0 tf],[f0 fdot0 fdotdot0]);
plot(T(:,1),Y(:,2));
end;
In above code, [t0 tf] is span in which ode solver will solve the differential equation
[f0 fdot0 fdotdot0] is the value of f, f,f
Plot for f() vs
Plot for f(n)or u/U vs