R-K Method MATLAB Code
R-K Method MATLAB Code
% From
https://www.mathworks.com/matlabcentral/fileexchange/29851-
runge-kutta-4th-order-ode?focused=3773771&tab=function
% It calculates ODE using Runge-Kutta 4th order method
% Author Ido Schwartz
% Modified by Irtaza Sohail
a = input(prompt1);
b = input(prompt2);
h = input(prompt3);
for i=1:n
k_1 = F_xy(x(i),y(i));
k_2 = F_xy(x(i)+0.5*h,y(i)+0.5*h*k_1);
k_3 = F_xy((x(i)+0.5*h),(y(i)+0.5*h*k_2));
k_4 = F_xy((x(i)+h),(y(i)+k_3*h));
y=
Columns 1 through 9
Columns 10 through 11
4.8151 5.3054