User Tools

Site Tools


Math 445 HW3: Home run

It is easy to determine the trajectory of a projectile subject to gravity if you neglect air resistance. It is much more difficult to solve if you include air resistance, especially if the flow becomes turbulent and the resistive force is nonlinear. We can only solve the nonlinear case numerically.

For this lab, you will determine the minimum speed and optimal angle at which to hit a baseball in order to score a home run, both at sea level and at high altitude (Denver). Assume that

  • the ball is hit 1 meter above home plate and speed $v_0$ and angle $\theta_0$.
  • the outfield fence is 120 meters (394 feet) from home plate and 3 meters high (about 10 feet).

Problem 1: Write a Matlab function that computes and plots the trajectory of the baseball and determines whether the ball clears the outfield fence. The function inputs should be $v_0$ and $\theta_0$, and the output should be the height of the ball when it reaches the fence.

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. The following code will calculate $\mu$ for a standard baseball, given either value of $\rho_{air}$.

rho_air  = 1.196;  % kg/m^3, density of dry air, 21 C, sea level
rho_air  = 0.986;  % kg/m^3, density of dry air, 21 C, Denver

C_D = 0.3;       % drag coefficient for baseball (rough sphere)
g = 9.81;        % acceleration due to gravity in m/s^2
r = 0.0375;      % radius of baseball in m (3.75 cm)
A = pi*r^2;      % cross-sectional area of baseball in m^2
m = 0.145;       % mass of baseball in kg (145 gm

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

Problem 2: Determine the minimum initial ball speed and optimal angle that result in a home run, at sea level, and in Denver. You'll have to start with a guess and tweak it by stages. For a starting point, recall that a good fastball clocks at 90 mph or roughly 40 m/s, and that 45 degrees is $\theta =\pi/4 \approx 0.78$.

Note that Matlab's ode45 function will return the x,y positions of the trajectory points at discrete time intervals, and it's unlikely that any of these will line up exactly with the outfield fence. However you can use interpolation to get the ball height y at exactly at the fence, as follows. If you set up your Matlab code so that $x$ is x(:,1) and $y$ is x(:,2), the following code will determine the height $y$ of the ball at the position of the fence, $x=120$.

yfence = interp1(x(:,1), x(:,2), 120);  

Problem 3: For the optimal sea level home run, make a plot that shows the $x,y$ trajectory of the homerun hit with the minimal speed and optimal angle, which you determined in problem 2. Now add another curve that shows what the path of the ball would be if there were no air resistance. Use a solid line for the curve with air resistance, and a dashed line for the curve without.

Problem 4: Do the same as problem 3 for the home run in Denver.

gibson/teaching/fall-2014/math445/lab8.txt · Last modified: 2015/04/24 14:25 by gibson