User Tools

Site Tools


gibson:teaching:fall-2013:math445:lab11

Math 445: Projectile motion

It is easy to determine the trajectory of a projectile subject to gravity if you neglect air resistance. using elementary physics and calculus, you can show that a projectile will travel farthest horizontal distance over a flat surface if you shoot it at an angle $\theta = \pi/4$ above the horizontal. In this problem you will determine the optimal angle and the maximum range of a given projectile subject to air resistance. Use the following equations of motion, developed during class

$ dx/dt = v_x $

$ dy/dt = v_y $

$ dv_x/dt = -\mu v_x \sqrt{v_x^2 + v_y^2}$

$ dv_y/dt = -g - \mu v_y \sqrt{v_x^2 + v_y^2}$

The constant $g = 9.81 m/s^2$ is the acceleration due to gravity. The constant $\mu = 1/2 \rho_{air} C_D A/m$ in the air resistance term depends on physical characteristics of the projectile and the air. We will solve the problem for an iron cannonball 20cm in diameter. The following code will calculate $\mu$ correctly given appropriate physical constants

rho_air  = 1.28; % kg/m^3, density of air
rho_iron = 7870; % kg/m^3, density of iron 7.87 gm/cm^3 == 0.00787 kg/(0.01m)^3 = 7870 kg/m^3
C_D = 1;         % drag coefficient for sphere
g = 9.81;        % m/s^2, acceleration due to gravity
r = 0.10;        % m, radius of cannonball
A = pi*r^2;      % cross-sectional area of cannonball
m = rho_iron*4/3*pi*r^3; % mass of cannonball

mu = rho_air*C_D*A/(2*m); % coefficient of nonlinear v|v| term, in mks units

Problem 1: Write a Matlab script to plot the trajectory of a cannonball subject to the above equations of motion and shot with an initial speed of 100 m/s at an angle $\theta=\pi/4$ above the horizontal. Produce a plot of the trajectory in the (x,y) plane of the cannonball with and without air resistance, both in the same plot.

Problem 2: Answer the following questions. You might need to modifying your script to answer the questions

(a) How far does the cannonball go in x with and without air resistance, if you shoot it at $\theta = \pi/4$? [Hint: set $\mu=0$ to compute the trajectory without air resistance.]

(b) What initial angle $\theta$ gives the farthest range with air resistance?

(c) If $\theta = \pi/4$, how much do you have to increase the initial velocity so the x distance is as large as it is without air resistance?

Hints: It's probably easiest to answer (a)-(c) if you turn your script into a function xdistance = projectile(v0, theta) that returns the distance the projectile travels as a function of the initial velocity and angle. In other words, create a new function “projectile.m”

function xdistance = projectile(v0,theta)

rho_air  = 1.28; % kg/m^3, density of air
rho_iron = 7870; % kg/m^3, density of iron 7.87 gm/cm^3 == 0.00787 kg/(0.01m)^3 = 7870 kg/m^3
C_D = 1;         % drag coefficient for sphere
g = 9.81;        % m/s^2, acceleration due to gravity
. 
.
.
f = @(t,x) [ ....];

[t,x]= ode45(f,[0:0.1:200] ,[ 0,0,v0*cos(theta), v0*sin(theta) );

xdistance = interp1(x(50:end,2), x(50:end,1), 0);  % This is how you can compute ''xdistance''
% accurately from an ''x,y'' trajectory using interpolation. 
% It will return the value of $x$ for which $y=0$, i.e. 
% where the cannonball hits the ground. 

end

Once your function works, play around with the parameters v0, theta to answer the questions. On the command line, you can USE this function like this.

  xdistance = projectile(100,pi/2)
  xdistance = projectile(100,pi/4)
  xdistance = projectile(100,pi/8)

If your xdistance is a NaN, you may have to increase the number 50 in the interp1 function (1000 might be good, that is roughly half the length of [0:0.1:200]).

gibson/teaching/fall-2013/math445/lab11.txt · Last modified: 2013/12/05 09:10 by szeto