ESTE PROGRAMA ES DESARROLLADO CON MATLAB
function RungeKutta2(f,t0,tf,h,y0)
disp('********************************************************************')
disp('* METODO RUNGE-KUTTA DE SEGUNDO ORDEN *')
disp('********************************************************************')
% [X,Y] = RungeKutta2(f,t0,tf,h,y0)
%
% Metodo Runge-Kutta de segundo orden para resolver una ecuacion
% diferencial ordinaria de la forma:
%
% dy
% -- = f(x,y) con condicion incial y(t0) = y0
% dx
x = t0;
y = y0;
Y = y';
X = x;
while x<tf
k1 = feval(f,x,y);
k2 = feval(f,x+(3/4)*h,y+(3/4)*k1*h);
y = y + h*(k1+2*k2)/3;
x = x + h;
Y = [Y;y'];
X = [X;x];
end
disp(' X Y')
[X Y]
plot(X,Y,'g'),title('GRAFICO METODO RUNGE-KUTTA DE SEGUNDO ORDEN','color','B');
<>