function vdot = quad_drag(t,v)
%QUAD_DRAG  Trajectory of baseball under quadratic drag force.

%   Dale E. Gary 
%   $Revision: 1.0 $  $Date: 2008/09/01 10:37:00 $

% Inputs T (time value--not used)
%        V (velocity vector: v(1) = v_x, v(2) = v_y)
% Output VDOT (acceleration column vector: vdot(1) = vdot_x, vdot(2) = vdot_y)

diam = 0.07;   % Diameter of baseball, in m
gamma = 0.25;  % Coefficient of drag in air at STP, in Ns^2/m^2
m = 0.15;   % Mass of baseball, in kg
g = 9.8;       % Acceleration of gravity, in m/s
c = gamma*diam^2;

vdot_x = -(c/m)*sqrt(v(1)^2+v(2)^2)*v(1);
vdot_y = -g-(c/m)*sqrt(v(1)^2+v(2)^2)*v(2);
vdot = [vdot_x; vdot_y];