10.05.2013 Views

texto: metodos numericos para ecuaciones diferenciales ordinarias

texto: metodos numericos para ecuaciones diferenciales ordinarias

texto: metodos numericos para ecuaciones diferenciales ordinarias

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

los parámetros en forma adecuada.<br />

La función sol guarda la solución exacta de la ecuación diferencial.<br />

Programa rungkufeh2.m<br />

a=1;b=4;yo=1;<br />

tol=10^(-6);<br />

hmax=0.5;<br />

hmin=0.02;<br />

x=a;<br />

w=yo;<br />

h=hmax;<br />

band=1;<br />

fprintf(’ xi’);<br />

fprintf(’ yi=y(xi)’);<br />

fprintf(’ wi’);<br />

fprintf(’ hi’);<br />

fprintf(’ |yi-wi|’);<br />

fprintf(’ wi’);<br />

fprintf(’ |yi-wii|\n’);<br />

fprintf(’%12.3f’,x);<br />

fprintf(’%12.3f’,sol(x));<br />

fprintf(’%12.3f’,w);<br />

fprintf(’ ’);<br />

fprintf(’%12.3f\n’,sol(x)-w);<br />

while band==1<br />

k1=h*ff(x,w);<br />

k2=h*ff(x+(1/4)*h,w+(1/4)*k1);<br />

k3=h*ff(x+(3/8)*h,w+(3/32)*k1+(9/32)*k2);<br />

k4=h*ff(x+(12/13)*h,w+(1932/2197)*k1-(7200/2197)*k2+(7296/2197)*k3);<br />

k5=h*ff(x+h,w+(439/216)*k1-8*k2+(3680/513)*k3-(845/4104)*k4);<br />

k6=h*ff(x+(1/2)*h,w-(8/27)*k1+2*k2-(3544/2565)*k3+(1859/4104)*k4-(11/40)*k5);<br />

R=(1/h)*abs((1/360)*k1-(128/4275)*k3-(2197/75240)*k4+(1/50)*k5+(2/55)*k6);<br />

if R

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!