Jensen_Grant_Project2.docx

Projectile as a function of time wo air resistance

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

View Full Document Right Arrow Icon
projectile as a function of time w/o air resistance      else         u(i) = U*(exp(-k*t(i)));  %Velocity of the projectile in the horizontal direction w/ air resistance         v(i) = V*(exp(-k*t(i))) + ((g/k)*((exp(-k*t(i)))-1));  %Velocity of the projectile in the vertical direction w/ air resistance         v_t(i) = sqrt((u(i))^2 + (v(i))^2);  %Velocity vector         x(i) = ((U/k)*(1-exp(-k*t(i))));  %Range in km of the projectile as a  function of time w/ air resistance         y(i) = (((-(g*t(i))/k) + ((k*V+g)/(k^2))*(1-exp(-k*t(i)))));  %Altitude in km of the projectile as a function of time w/ air resistance      end     i = i + 1;  %Vector element counter     t(i) = t(i-1) + dt;  %Creates vector for flight time      %I calculated range and max flight time in the main_range.m script end t(end) = []; end plot_flightpaths.m function  [ yx , yt , ut , vt ] = plot_flightpaths( t , u , v , x , y ) %Grant Jensen, AER E 161, Project #2 %plot_flightpaths plots flightpaths by using the data calculated by  flightpath.m %   Creates plots of altitude vs distance, altitude vs time,  %   horizontal velocity vs time, and vertical velocity vs time %   To call the function: plot_flightpaths(t,u,v,x,y) % %   Input arguments: t, u, v, x, y %       Where: t is time, u is horizontal velocity, v is vertical velocity, x %       is position on the x-axis (range/distance), and y is altitude % %   Output arguments: yx, yt, ut, vt %       Where: yx, yt, ut, vt are plots   %Creates the graph for y versus x figure(1);  %Makes a new figure for the y vs x graph yx = plot(x,y);  %Plots the graph of altitude vs distance legend( 'k = 0' , 'k = 0.005' , 'k = 0.01' , 'k = 0.02' , 'k = 0.04' , 'k = 0.08' );  %Creates the legend title( 'Altitude vs Distance' %Titles the graph xlabel( 'Distance (km)' %x-axis label ylabel( 'Altitude (km)' %y-axis label grid  on   %Makes grid lines appear
Image of page 8

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

View Full Document Right Arrow Icon
Flight Path of a Projectile 9 hold  on   %Retains plots from this loop and previous loops so that new plots do  not delete existing plots. clc  %Clears the warning messages   %Creates the graph for y vs t figure(2);  %Makes a new figure for the y vs t graph yt = plot(t,y);  %Plots the graph of altitude vs time legend( 'k = 0' , 'k = 0.005' , 'k = 0.01' , 'k = 0.02' , 'k = 0.04' , 'k = 0.08' );  %Creates the legend title( 'Altitude vs Time' %Titles the graph xlabel( 'Time (s)' %x-axis label ylabel( 'Altitude (km)' %y-axis label grid  on   %Makes grid lines appear hold  on   %Retains plots from this loop and previous loops so that new plots do  not delete existing plots. clc  %Clears the warning messages   %Creates the graph for u vs t figure(3);  %Makes a new figure for the u vs t graph ut = plot(t,u);  %Plots the graph of horizontal velocity vs time A = legend( 'k = 0' , 'k = 0.005' , 'k = 0.01' , 'k = 0.02' , 'k = 0.04' , 'k = 0.08' );  %Creates the legend set(A, 'Fontsize' ,6); 
Image of page 9
Image of page 10
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