ASE 167M - Runge-Kutta step 4

ASE 167M - Runge-Kutta step 4 - X(j) = X(j-1) + v(j-1)*Dt;...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
clear all close all clc global g W Sw CDstar CLstar CD0 = 0.02; K = 0.07; h0 = 10000; g = 32.2; t0 = 0; W = 11000; CLstar = sqrt(CD0 / K); CDstar = 2 * CD0; Sw = 232; [temp, press, dens, sos] = atmos62(h0); V0 = sqrt(2 * W / (dens * Sw * CLstar)); gamma0 = -1 * CDstar / CLstar; x0 = 0; z0 = [x0; h0; V0; gamma0]; h = h0; t = t0; time(1) = t0; i = 0; dt = 2; htol = 1e-4; [Z] = RK4(@gf_derivs, [t t + dt], z0); h = Z(2); if(h < -htol) dt = 0.5 * dt; if (dt < 1e-9) break end elseif(h > htol) t = t + dt; i = i + 1; time(i) = t; z0 = Z; x(i) = Z(1); H(i) = Z(2); V(i) = Z(3); gamma(i) = Z(4); end end e hieght(1) = h0; X(1) = x0; Gamma(1) = gamma0; v(1) = V0; j = 2; Dt = 2; hieght(j) = hieght(j-1) + v(j-1)*Gamma(j-1)*Dt;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: X(j) = X(j-1) + v(j-1)*Dt; [temp, press, dens, sos] = atmos62(hieght(j)); v(j) = sqrt(2 * W / (dens * Sw * CLstar)); Gamma(j) = Gamma(j-1); if (hieght(j) &lt; -htol) Dt = 0.5 * Dt; elseif (hieght(j) &gt; htol) j = j + 1; end end e figure(2) hold on %plot(x, H) plot(X, hieght) xlabel('Distance (ft)') ylabel('Altitude (ft)') title('Distance vs. Altitude') figure(3) hold on %plot(x, V) plot(X, v) xlabel('Distance (ft)') ylabel('Velocity (ft/sec)') title('Distance vs. Velocity') figure(4) hold on %plot(x, gamma) plot(X, Gamma) xlabel('Distance (ft)') ylabel('Flight Path Angle (rad)') title('Distance vs. Flight Path Angle') t...
View Full Document

This note was uploaded on 09/18/2011 for the course ASE 167M taught by Professor Staff during the Spring '10 term at University of Texas at Austin.

Page1 / 2

ASE 167M - Runge-Kutta step 4 - X(j) = X(j-1) + v(j-1)*Dt;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online