Upload
davismoody
View
221
Download
3
Embed Size (px)
DESCRIPTION
Algoritmo en Matlab
Citation preview
Metodo numérico Runge Kutta de cuarto ordenAlgoritmo en Matlab
Esto se crea en otra pestaña con el nombre de f1
function ye=f1(x,y)ye=x*y+1;
Esto también se crea en una diferente pestaña a la de arriba:
clear x,y;x0=0;y0=21;xf=10;n=20;h=(xf-x0)/n;i=1;x(i)=x0;y(i)=y0;while i<=n k1=h*f1(x0,y0); k2=h*f1(x0+h/2,y0+k1/2); k3=h*f1(x0+h/2,y0+k2/2); k4=h*f1(x0+h,y0+k3); km=(k1+2*k2+2*k3+k4)/6; y1=y0+km; x1=x0+h; i=i+1; x(i)=x1; y(i)=y1; x0=x1; y0=y1; disp([y1])endplot(x,y)grid on%disp([x1])%disp([y1])title('Método de Runge Kutta de cuarto orden')