Demonstrate JPL ephemeris for the solar system.

There are two functions, SolarSysJPL for inputing a time vector and PlanetPosJPL for getting the state at a specific time. ------------------------------------------------------------------------- See also SolarSysJPL, PlanetPosJPL, TextS, Date2JD, JDToDateString, InterpolateState -------------------------------------------------------------------------

Contents

%--------------------------------------------------------------------------
%	  Copyright (c) 2007 Princeton Satellite Systems, Inc.
%   All rights reserved.
%--------------------------------------------------------------------------

Initialize with 2000 data file

%--------------------------------
if ~exist('bin2000.405')
  error('You must create bin2000.405 on your system. See InterpolateState.');
end
InterpolateState([],[],'bin2000.405')

% The planets are ID 1 to 9. The moon is ID 10.
id = [1 2 3 4 5 10];
jD0 = Date2JD(2007);
ans =
     1

Demonstrate SolarSysJPL: planet positions over a time period

%--------------------------------------------------------------
tPlot = jD0+(0:365);
[xP, yP, zP] = SolarSysJPL( id, tPlot, 1 );

NewFig('Planets Trajectory');
s = JDToDateString( jD0 );
title(s)
plot3(xP(1,:)',yP(1,:)',zP(1,:)','y',...
      xP(2,:)',yP(2,:)',zP(2,:)','g',...
      xP(3,:)',yP(3,:)',zP(3,:)','b',...
      xP(4,:)',yP(4,:)',zP(4,:)','r',...
      xP(5,:)',yP(5,:)',zP(5,:)','m')
TextS(xP(1:5,1)',yP(1:5,1)',char({'Mercury','Venus','Earth','Mars','Jupiter'}))
grid on; axis equal;

Demonstrate PlanetPosJPL: planet positions at a specific time

%---------------------------------------------------------------
PlanetPosJPL( 'initialize', id );
rP  = PlanetPosJPL( 'update', jD0, 1 );
hold on
plot3(rP(1,1),rP(2,1),rP(3,1),'y*',...
      rP(1,2),rP(2,2),rP(3,2),'g*',...
      rP(1,3),rP(2,3),rP(3,3),'b*',...
      rP(1,4),rP(2,4),rP(3,4),'r*',...
      rP(1,5),rP(2,5),rP(3,5),'m*')

Plot the moon separately (geocentric)

%---------------------------------------
NewFig('Geocentric Moon Trajectory');
plot3(xP(end,1:28)',yP(end,1:28)',zP(end,1:28)')
grid on; axis equal;
hold on
plot3([rP(1,6) 0],[rP(2,6) 0],[rP(3,6) 0],'*')
TextS([rP(1,6) 0],[rP(2,6) 0],char({'Moon','Earth'}))
grid on; axis equal;

%--------------------------------------