function [p, v] = freefall_step ( p, v, dt ) % Takes position, velocity vectors and a time interval, and calculates % the final position and velocity vectors, returning them as [x, v]. % Position and velocity vectors are 3x1. % Only external force is gravity, in z direction. g = 9.8; % Metric % English units or not? p(1) = p(1) + v(1)*dt; % x = x + Vx*dt p(2) = p(2) + v(2)*dt; % y = y + Vy*dt p(3) = p(3) + v(3)*dt - .5*g*dt*dt; % z = z + Vz*dt - (1/2)g*dt^2 v(3) = v(3) - g*dt; % Vz = Vz - g*dt % All other values - Vx and Vy - remain the same.