This preview shows pages 1–5. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: % Solve the problem by A System of 1st Order ODE Method (Vertical 4th order % RungeKutta Method) % Note that, u_n means u(n), u_nn means u(n+1); u_n=u_0; v_n=v_0; while (flag) k1 = h*[c*u_n*sqrt(u_n^2+v_n^2);gc*v_n*sqrt(u_n^2+v_n^2)]; k2 = h*[c*(u_n+k1(1,1)/2)*sqrt((u_n+k1(1,1)/2)^2+(v_n+k1(2,1)/2)^2);gc*(v_n+k1(2,1)/2)*sqrt((u_n+k 1(1,1)/2)^2+(v_n+k1(2,1)/2)^2)]; k3 = h*[c*(u_n+k2(1,1)/2)*sqrt((u_n+k2(1,1)/2)^2+(v_n+k2(2,1)/2)^2);gc*(v_n+k2(2,1)/2)*sqrt((u_n+k 2(1,1)/2)^2+(v_n+k2(2,1)/2)^2)]; k4 = h*[c*(u_n+k3(1,1))*sqrt((u_n+k3(1,1))^2+(v_n+k3(2,1))^2);gc*(v_n+k3(2,1))*sqrt((u_n+k3(1,1))^ 2+(v_n+k3(2,1))^2)]; kavg=(k1+2*k2+2*k3+k4)/6; u_nn=u_n+kavg(1,1); v_nn=v_n+kavg(2,1); if (v_nn>0) i=i+1; t_n = i*h; u_n=u_nn; v_n=v_nn; else flag=0; end end % calculate the average value of t(n) and t(n+1) which the vertical % velocity changes its sign. t_nn=t_n+0.01; tavg=(t_n+t_nn)/2 ****************************The average value of t(n) and t(n+1) is******************** tavg = 7.1950 >>...
View
Full
Document
This note was uploaded on 12/14/2011 for the course ME 218 taught by Professor Unknown during the Fall '08 term at University of Texas at Austin.
 Fall '08
 Unknown

Click to edit the document details