Jensen_Grant_Project2.pdf

Plotflightpaths plots flightpaths by using the data

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

View Full Document Right Arrow Icon
%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 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
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 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); %Sets the font size of the legend to 6 title( 'Horizontal Velocity vs Time' ) %Titles the graph xlabel( 'Time (s)' ) %x-axis label ylabel( 'Horizontal Velocity (m/s)' ) %y-axis label xlim([0 106]) %Creates an x-limit from 0-106 ylim([0 310]) %Helps make the graph of u vs t when k = 0 visible 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 v vs t figure(4); %Makes a new figure for the v vs t graph vt = plot(t,v); %Plots the graph of vertical velocity vs time legend( 'k = 0' , 'k = 0.005' , 'k = 0.01' , 'k = 0.02' , 'k = 0.04' , 'k = 0.08' ); %Creates the legend title( 'Vertical Velocity vs Time' ) %Titles the graph xlabel( 'Time (s)' ) %x-axis label ylabel( 'Vertical Velocity (m/s)' ) %y-axis label xlim([0 106]) %Creates an x-limit from 0-106 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 end main_range.m clear, clc %Grant Jensen, AER E 161, Project #2, main_range %Uses the functions flightpath.m and plot_range to graph Range(x) vs Air Resistance(k) and Total flight time(t) vs Air Resistance(k) v_0 = 600; %Launch velocity in m/s l_ang = 60; %Launch angle in degrees above the horizontal k = 0:0.001:0.08; %Coefficent of friction in s^-1 for j = 1:length(k) %Loops 6 times %Calls the flightpath function. The i value in k(i) changes every iteration to generate new vectors [ t , u , v , v_t , x , y ] = flightpath( v_0 , l_ang , k(j) );
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