Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad

La quimica es vida salud, Esquemas y mapas conceptuales de Química

Xomo el dia ha sia poner haxee vuen las codas

Tipo: Esquemas y mapas conceptuales

2021/2022

Subido el 22/02/2023

xiomara-huaman-1
xiomara-huaman-1 🇵🇪

7 documentos

1 / 1

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
ALGORITMO DE RUNGE KUTTA DE CUARTO ORDEN PARA RESOLVER UNA ECUACIÓN
DIFERENCIAL
function f
fprintf('\n \tRESOLUCION DE ECUACIONES DIFERENCIALES POR
MEDIO RUNGE-KUTTA DE ORDEN 4\n')
f=input('\n Ingrese la ecuacion diferencial\n','s');
x0=input('\n Ingrese el primer punto x0:\n');
x1=input('\n Ingrese el segundo punto x1:\n');
y0=input('\n Ingrese la condicion inicial y(x0):\n');
n=input('\n Ingrese el numero de pasos n:\n');
h=(x1-x0)/n;
xs=x0:h:x1;
fprintf('\n''it x0 y(x1)');
for i=1:n
it=i-1;
x0=xs(i);
x=x0;
y=y0;
k1=h*eval(f);
x=x0+h/2;
y=y0+k1/2;
k2=h*eval(f);
x=x0+h/2;
y=y0+k2/2;
k3=h*eval(f);
x=x0+h;
y=y0+k3;
k4=h*eval(f);
y0=y0+(k1+2*k2+2*k3+k4)/6;
fprintf('\n%2.0f%10.4f%10.4f\n',it,x0,y0);
end
fprintf('\n El punto aproximado y(x1) es = %8.4f\n',y0);

Vista previa parcial del texto

¡Descarga La quimica es vida salud y más Esquemas y mapas conceptuales en PDF de Química solo en Docsity!

ALGORITMO DE RUNGE KUTTA DE CUARTO ORDEN PARA RESOLVER UNA ECUACIÓN DIFERENCIAL function f fprintf('\n \tRESOLUCION DE ECUACIONES DIFERENCIALES POR MEDIO RUNGE-KUTTA DE ORDEN 4\n') f=input('\n Ingrese la ecuacion diferencial\n','s'); x0=input('\n Ingrese el primer punto x0:\n'); x1=input('\n Ingrese el segundo punto x1:\n'); y0=input('\n Ingrese la condicion inicial y(x0):\n'); n=input('\n Ingrese el numero de pasos n:\n'); h=(x1-x0)/n; xs=x0:h:x1; fprintf('\n''it x0 y(x1)'); for i=1:n it=i-1; x0=xs(i); x=x0; y=y0; k1=heval(f); x=x0+h/2; y=y0+k1/2; k2=heval(f); x=x0+h/2; y=y0+k2/2; k3=heval(f); x=x0+h; y=y0+k3; k4=heval(f); y0=y0+(k1+2k2+2k3+k4)/6; fprintf('\n%2.0f%10.4f%10.4f\n',it,x0,y0); end fprintf('\n El punto aproximado y(x1) es = %8.4f\n',y0);