![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/404730/image.png)
Help using ode45 to solve 3rd order ODE
조회 수: 18 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/404730/image.png)
댓글 수: 2
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
2020년 11월 6일
Correct. This was just a coincidence. This equation can only have 3 boundary conditions.
참고 항목
카테고리
Help Center 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!