% First test of basketball equations of motion
function bbtest1

v0 = [40000, 30000]; % Initial velocity (m/s)
   % Note: 50 m/s = 112 mph
x0 = [0,0];   % Initial position (m)
q0 = [x0,v0]; % Initial state vector
Nsteps = 100; % Number of integration steps
total_time = 10; % Integration time (s)
t = (0:Nsteps) * total_time / Nsteps; % Array of times

trajectory = lsode2(@basketball, q0, t);

x = trajectory(:,1);
y = trajectory(:,2);
u = trajectory(:,3);
v = trajectory(:,4);

plot(x,y)
axis equal