% oneShot.m
% Finds and plots the trajectory of two shots.
% J.M.Soler, Dec.2015.

% Set parameters
clear
m = 1;               % particle mass, in kg
r0 = [0;0];          % initial position is set at the origin
v0 = [5;10];         % initial velocity, in m/s
dt = 0.1;            % integration time interval, in s
tmax = 2.5;          % final integration time, in s

% Set force function
myForce = @(r)earthGravity(m,r); 

% Find trajectory
r = verlet( myForce, m, r0, v0, dt, tmax);

% Plot trajectory
plot(r(1,:),r(2,:),'o-')
axis equal
axis([0,11, 0,6])
xlabel('x (m)'), ylabel('y (m)')
title('One shot')
