{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

RungeKuttaMethod - t0=0 t1=100 h= t1-t0 k1 = feval(vp t0,v0...

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

View Full Document Right Arrow Icon
%Runge-Kutta Method % fuction vp = bolt1(t,v) 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]
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: [ t0=0; t1=100; h= t1-t0; k1 = feval(vp, t0,v0); k2 = feval(vp, t0 +h/2, v0 +(h/2)*k1); k3 = feval(vp, t0 +h/2, v0 +(h/2)*k2); k4 = feval(vp, t0+h, v0 + h*k3); k= (1/6)*(k1+2*k2+2*k3+k4); t=t1; y=y0+h*k; y...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online