Help using ode45 to solve 3rd order ODE

56 ビュー (過去 30 日間)
AJD
AJD 2020 年 11 月 6 日
コメント済み: Ameer Hamza 2020 年 11 月 6 日
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

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 11 月 6 日
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 件のコメント
David Goodmanson
David Goodmanson 2020 年 11 月 6 日
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 2020 年 11 月 6 日
Correct. This was just a coincidence. This equation can only have 3 boundary conditions.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by