mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-06 15:43:14 +02:00
13 lines
379 B
Matlab
13 lines
379 B
Matlab
% ENUME MICHAŁ SZOPIŃSKI
|
|
% PROJECT C NUMBER 60
|
|
% https://github.com/Lachcim/szopinski-enume
|
|
|
|
% calculate the phi for RK4 algorithms
|
|
function phi = rk4phi(fun, stepval, stepsize)
|
|
k1 = fun(stepval);
|
|
k2 = fun(stepval + 0.5 * stepsize * k1);
|
|
k3 = fun(stepval + 0.5 * stepsize * k2);
|
|
k4 = fun(stepval + stepsize * k3);
|
|
phi = (k1 + 2 * k2 + 2 * k3 + k4) / 6;
|
|
end
|