mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 22:43:11 +02:00
9 lines
329 B
Matlab
9 lines
329 B
Matlab
function Phi = RK4Phi(algorithm, stepValue, stepSize)
|
|
k1 = algorithm(stepValue);
|
|
k2 = algorithm(stepValue + 0.5 * stepSize * k1);
|
|
k3 = algorithm(stepValue + 0.5 * stepSize * k2);
|
|
k4 = algorithm(stepValue + stepSize * k3);
|
|
Phi = (k1 + 2 * k2 + 2 * k3 + k4) / 6;
|
|
end
|
|
% calculates the Phi used in RK4 algorithms
|