RungeKuttaMethod - vp = -0.04*v-9.8; v n = 100; [t1,v1]=...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%Runge-Kutta Method % function[t,y] = rk h=t1-t0; k1 = feval(yp, t0,y0); k2 = feval(yp, t0 +h/2, y0 +(h/2)*k1); k3 = feval(yp, t0 +h/2, y0 +(h/2)*k2); k4 = feval(yp, t0+h, y0 + h*k3); k= (1/6)*(k1+2*k2+2*k3+k4); t=t1; y=y0+h*k; y fuction vp = vpbolt1(t,v)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: vp = -0.04*v-9.8; v n = 100; [t1,v1]= ode('rk', 'vpbolt1',0,10,49,n); [ n = 200; [t2,v] = ode('rk', 'vpbolt1',0,10,45,n); t = (0:10)'; t ve = 294*exp(-t/25)-245; [t, v1(1:n/20:1+n/2), v(1:n/10:n+1), ve]...
View Full Document

This note was uploaded on 01/24/2011 for the course ENGR 1020 taught by Professor Keith during the Spring '10 term at Utah State University.

Ask a homework question - tutors are online