function rungekuttah = 0.1; %tamao de paso
t = 0; %valor incial del intervalo
a = 1; %valor final del intervalo
w = 0.5; %condicin inicial
n=(a-t)/h; %cantidad de subintervalos
for i=0:n-1k1 = h*f(t,w);k2 = h*f(t+h/2, w+k1/2);k3 = h*f(t+h/2, w+k2/2);k4 = h*f(t+h, w+k3);wo = w + (k1+2*k2+2*k3+k4)/6;to = t + h;fprintf('Step %d: to = %6.4f\n wo = %18.15f\n', i, to, wo);plot(wo, to)end%%%%%%%%%%%%%%%%%%
function v = f(t,y)v = y-t^2+1;
MATLAB: Does anyone could help me out with this RK4 code, the code runs but it does plot nothing
runge_kutta code
Best Answer