COMPUTACIÓN CIENTIFICA

.

C A R L O S
 

ESTE PROGRAMA ES DESARROLLADO CON MATLAB
function RungeKuttaOS(f,h,y0,t0,tf)
% colocar en la ventana de matlab: RungeKutta4('f',h,y0,t0,tf)
% Metodo Runge-Kutta de orden superior para resolver una ecuacion
% diferencial ordinaria de la forma:
%
%   dy
%   -- = f(x,y)  con condicion incial y(t0) = y0
%   dx
disp('-------------------------------------------------------------------')
disp('                 RUNGE-KUTTA DE ORDEN SUPERIOR                           ')
disp('-------------------------------------------------------------------')
x = t0;
y = y0;
Y = y';
X = x;
while x<tf
   k1 = feval(f,x,y);
   k2 = feval(f,x+(1/4)*h,y+(1/4)*k1*h);
   k3 = feval(f,x+(1/4)*h,y+(1/8)*k1*h+(1/8)*k2*h);
   k4 = feval(f,x+0.5*h,y-(1/2)*k2*h+k3*h);
   k5 = feval(f,x+(3/4)*h,y+(3/16)*k1*h+(9/16)*k4*h);
   k6 = feval(f,x+h,y-(3/7)*k1*h+(2/7)*k2*h+(12/7)*k3*h-(12/7)*k4*h+(8/7)*k5*h);
   y = y + (7*k1+32*k3+12*k4+32*k5+7*k6)*h/90;
   x = x + h;  
   Y = [Y;y'];
   X = [X;x];
end
disp('        X         Y');
[X Y]
grid on
plot(X,Y,'g')
title('Runge-Kutta de orden superior','color','B')
<>

 
Hoy habia 1 visitantes (3 clics a subpáginas) ¡Aqui en esta página!

GRACIAS POR SU VISITA

. Este sitio web fue creado de forma gratuita con PaginaWebGratis.es. ¿Quieres también tu sitio web propio?
Registrarse gratis