Help using ode45 to solve 3rd order ODE

56 visualizaciones (últimos 30 días)
AJD
AJD el 6 de Nov. de 2020
Comentada: Ameer Hamza el 6 de Nov. de 2020
I'm having trouble figuring out how to use the ode45 funciton in MATLAB to solve the following 3rd order ODE:
F''' + F*F'' = 0
With initial conditions F(0) = 0, F'(0) = 1, F''(inf) = 0, and F''(0) = -0.6276.
I am new to the ode45 function, and any help would be greatly appreciated

Respuestas (1)

Ameer Hamza
Ameer Hamza el 6 de Nov. de 2020
Convert your 3rd order ODE into a system of 3-first order ODEs
IC = [0; 1; -0.6276];
tspan = [0 10];
[t, y] = ode45(@odefun, tspan, IC);
plot(t, y);
legend({'$F$', '$\dot{F}$', '$\ddot{F}$'}, 'FontSize', 16, 'Interpreter', 'latex', 'Location', 'best')
function dFdt = odefun(t, F)
dFdt = zeros(3, 1);
dFdt(1) = F(2);
dFdt(2) = F(3);
dFdt(3) = -F(1)*F(3);
end
  2 comentarios
David Goodmanson
David Goodmanson el 6 de Nov. de 2020
Hi AJD,
Ameer's answer, while correct, does not say anything about the fact that you have a third order differential equation and four boundary conditions. That's one too many conditions, and overspecifies the problem. So you had better hope that if you use the three initial conditions at t=0, the answer will automatically end up with f''(inf) = 0. Fortunately, it does.
Ameer Hamza
Ameer Hamza el 6 de Nov. de 2020
Correct. This was just a coincidence. This equation can only have 3 boundary conditions.

Iniciar sesión para comentar.

Categorías

Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by