% Just type the name of this file without the ".m" to run it
% ========================================================================
clear all
close all

% Set your integration time to run from t = 0 to t = final_time
runtime = [ 0 86400 ];

% Set your intial state
X0 = [8000  0  6000  0  5  5 ];

% Integrate the trajectory using ODE45 calling the EOM file "twobodyEOM"
[t,y] = ode45('twobodyEOM', runtime, X0);

% NOTE: your outputs will not display because you use the ";" after the
% line or command.  To see it just type "t" or "y" on your commandline

X  = y(:,1); % So now all your X is y(:,1)
Y  = y(:,2); % So now all your Y is y(:,2)
Z  = y(:,3); % So now all your Z is y(:,3)
DX = y(:,4); % So now all your DX is y(:,4)
DY = y(:,5); % So now all your DY is y(:,5)
DZ = y(:,6); % So now all your DZ is y(:,6)

% -----------------------------------------
% Put you plot command here:
% -----------------------------------------

% add a sphere the size of the Earth on the plot
[ex,ey,ez]=ellipsoid(0,0,0,6368,6378,6378,40);
surf(ex,ey,ez)

hold on         % so that you can plot others object on the same plot

plot3(X,Y,Z)    % plot x versus y 
axis equal      % makes the axis equal in scale


% =========================================================================
