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.

end<br />

T=[t];<br />

y=[w];<br />

w(j)=c(j)<br />

for i=1:N,<br />

end<br />

for j=1:m,<br />

end<br />

k1(j)=h*fs(t,w(1),w(2),j);<br />

for j=1:m,<br />

end<br />

k2(j)=h*fs(t+h/2,w(1)+(1/2)*k1(1),w(2)+(1/2)*k1(2),j);<br />

for j=1:m,<br />

end<br />

k3(j)=h*fs(t+h/2,w(1)+(1/2)*k2(1),w(2)+(1/2)*k2(2),j);<br />

for j=1:m,<br />

end<br />

k4(j)=h*fs(t+h,w(1)+k3(1),w(2)+k3(2),j);<br />

for j=1:m,<br />

end<br />

w(j)=w(j)+(k1(j)+2*k2(j)+2*k3(j)+k4(j))/6<br />

t=a+i*h;<br />

T=[T;t];<br />

y=[y;w]<br />

input(’pulse’)<br />

fprintf(’%4.4f ’,T(i+1));<br />

fprintf(’%12.6i ’,w(1));fprintf(’%12.6i\n’,w(2));<br />

plot(T,y(:,1))<br />

xlabel(’tiempo (s)’);<br />

ylabel(’posicion (m)’);<br />

grid<br />

Programa fs.m<br />

function y1=fs(t,x1,x2,j)<br />

31

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

Saved successfully!

Ooh no, something went wrong!