CSPICE_SPKW08 writes a type 8 segment to an SPK file.
handle the file handle of an SPK file open for writing.
[1,1] = size(handle); int32 = class(handle)
body the SPICE ID code for an ephemeris object
whose state relative to another body is described
by the segment to be created.
[1,1] = size(body); int32 = class(body)
center the SPICE ID code for the center of motion
of the object identified by body.
[1,1] = size(center); int32 = class(center)
frame the name for a reference frame relative to which the state
information for body is specified.
[1,c1] = size(fname); char = class(fname)
[1,1] = size(fname); cell = class(fname)
last are, respectively, the start and stop times of
the time interval over which the segment defines
the state of body.
[1,1] = size(first); double = class(first)
[1,1] = size(last); double = class(last)
segid is the segment identifier. An SPK segment
identifier may contain up to 40 characters.
degree the degree of the Lagrange polynomials used to
interpolate the states. All components of the
state vectors are interpolated by polynomials of
[1,1] = size(degree); int32 = class(degree)
states contains a time-ordered array of geometric states
( x, y, z, dx/dt, dy/dt, dz/dt, in kilometers and
kilometers per second ) of body relative to center,
specified relative to frame.
[6,m] = size(states); double = class(states)
epoch1 the epoch corresponding to the first state in
the state array. Because extra states are needed
at the beginning and end of the segment in order
for the interpolation method to work, epoch1 will
normally precede first.
[1,1] = size(epoch1); double = class(epoch1)
step the time step separating the epochs of adjacent
states in the input state array. step is specified
in TDB seconds.
[1,1] = size(step); double = class(step)
cspice_spkw08( handle, body, center, frame, first, ...
last, segid, degree, states, epoch1, ...
The routine writes to the SPK file referred to by 'handle' a type 8 SPK
segment containing the data listed in 'states'.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
% Define the segment identifier parameters.
BODY = 3;
CENTER = 10;
REF = 'J2000';
POLY_DEG = 3;
SPK8 = 'test8.bsp';
N_DISCRETE = 9;
% A set of epochs.
DISCRETEEPOCHS = (1:9)*100;
% An array of discrete states to write to the SPK segment.
base = [ (1:6)*100 ]';
% Create the 6xN array of states.
DISCRETESTATES = [(base+1), (base+2), (base+3), ...
(base+4), (base+5), (base+6), ...
(base+7), (base+8), (base+9) ];
% Create a segment identifier.
segid = 'SPK type 8 test segment';
% Open a new SPK file. Delete if a file of the same name exists.
if ( exist( SPK8, 'file' ) == 2 )
delete( SPK8 )
handle = cspice_spkopn( SPK8, segid, 4 );
step = DISCRETEEPOCHS(2) - DISCRETEEPOCHS(1);
% Create a type 8 segment.
cspice_spkw08( handle, ...
% Close the SPK file.
cspice_spkcls( handle )
SPK file "test8.bsp" created containing a single type 8 segment.
For important details concerning this module's function, please refer to
the CSPICE routine spkw08_c.
-Mice Version 1.0.0, 23-MAY-2012, EDW (JPL)
write spk type_8 ephemeris data segment