Projectile analysis in matlab

The basic equations of interest here pertain to a projectile, the football, being kicked at some launch speed and launch angle, experiencing gravitational and drag forces as it travels along its trajectory.* Specifically, let us assume that the football is positioned at the origin (x0, y0)=(0, 0) and kicked with a speed v0 at some angle ? relative to the x-axis (see figure). The equations that govern the motion of the football, written out separately for the x and y components, are

 

projectile-analysis-in-matlab

where vx(t), vy(t), ax(t), ay(t) are the x and y components of velocity and acceleration, respectively. Note that all of these quantities are functions of time t. Equations 1 and 2 are generalizations of the quadratic drag model that we discussed and worked out in class. However, unlike the example we did in class, where we considered an object falling vertically downwards and were able to integrate the equation of motion analytically, Equations 1 and 2 can no longer be solved analytically due to the coupling between x and y components. We will therefore pursue a numerical integration procedure that is entirely analogous to the example we did in class (see file parachute_all_numerical.m).

 

projectile-analysis-in-matlab

Suppose we know the positions, x(ti) and y(ti), velocities, vx(ti) and vy(ti), and accelerations, ax(ti) and ay(ti), at the i th instant of time ti. We calculate the velocities at the (i+1)th instant of time ti+1= ti + h as

 

 

 

projectile-analysis-in-matlab

We cannot do the integrals in Eqs. 3 and 4 using the trapezoidal rule this would require us to know ax(ti+1) and ay(ti+1), which we cannot know until we are able to plug in values for vx(ti+1) and vy(ti+1) into Eqs. 1 and 2 – a chicken and egg problem. Therefore, we will simply approximate the integrals in Eqs. 3 and 4 as areas of rectangles under the curve, whence

Answer

 

% 1. % Initialize Parameters % Velocity v=30; % Mass m=0.4; % Drag Coefficient c=0.01; % Plot figure figure % for launch angle 10 to 90 with step of 10 degree for theta=10:10:90 % Compute trajectory [x,y]=calc_traj(v,m,c,theta); % Plot Trajectory of football plot(x,y,'DisplayName',['theta = ',num2str(theta),'^o']) 

projectile-analysis-in-matlab

 

projectile-analysis-in-matlab