Solving ODE in MATLAB using Runge-Kutta method of order 4
1 回表示 (過去 30 日間)
古いコメントを表示
Write a computer program that will solve the initial value problem dy/dx = f(x, y) subjected to y(x0) = y0 by classical fourth order Runge-Kutta method.
Inputs: x0, y0, f(x, y), h = step-size, and n = number of steps. Using the code obtain the solutions of the ODE
Compare each numerically obtained solution with corresponding analytical solution by plotting them in a single figure.
9 件のコメント
James Tursa
2021 年 12 月 14 日
編集済み: James Tursa
2021 年 12 月 14 日
Still not clear. Is the user supposed to know that z is dy/dx? How would they know this? Is the user supposed to enter a function handle directly using x, y, and z with the assumption that z is dy/dx?
回答 (1 件)
James Tursa
2021 年 12 月 14 日
Why aren't you using this to update z:
z(i+1) = z(i) + (1/6)*(l1+(2*l2)+(2*l3)+l4);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!