HW4_solution - Small script to solve HW3 Pb3 = Some...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
% Small script to solve HW3, Pb3 % ============================== % Some conversion factors d2r = pi/180.0; % degrees to radians r2d = 180.0/pi; % radians to degree m2d = 1.0/60.0; % minutes to degree % Some constants (units of km, kg, s) Re = 6372; W = pi/(12*60*60); h = 0.003; lat = (35+28.0*m2d)*d2r; lon = (-80+32*m2d)*d2r; % Initial conditions % ------------------ m0 = 60000.0; % Inertial space: X = [position, velocity, mass]; Pos0 = (Re+h)*[ cos(lon)*cos(lat); sin(lon)*cos(lat); sin(lat) ]; Vel0 = W*[ -Pos0(2); Pos0(1); 0.0 ]; X0 = [Pos0; Vel0; m0]; % Local frame: x = [position, velocity, mass]; pos0 = [ 0.0; 0.0; 0.0]; vel0 = [ 0.0; 0.0; 0.0]; x0 = [pos0; vel0; m0]; % Time span m_fuel = 50000.0; dmdt = -300.0; Tspan = [0.0; -m_fuel/dmdt]; % Trajectory integration % ---------------------- [T,X] = ode45(@Pb3_Finertial, Tspan, X0); [t,x] = ode45(@Pb3_Flocal, Tspan, x0); % Altitude and flight path angle % ------------------------------ % in the inertial frame [Ni,Mi] = size(X); alt_i = zeros(Ni,1); fpa_i = zeros(Ni,1); % altitude and flight path angle ( inertial) for i = 1:Ni, % inertial altitude and flight path angle R = norm(X(i,1:3)); U =[X(i,4)+W*X(i,2); X(i,5)-W*X(i,1); X(i,6)]; V = norm(U); alt_i(i) = R-Re; if (V==0.0) fpa_i(i) = 90.0; else fpa_i(i) = 90- acos( dot(X(i,1:3),U)/(R*V) )*r2d; end end % in the local reference frame [Nl,Ml] = size(x); alt_l = zeros(Nl,1); fpa_l = zeros(Nl,1);
Image of page 7

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

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern