This is an evolution of code provided by Edwin to do propagation in GMAT from MATLAB. The function GMAT_EphemGenFunc_03 takes a series of matlab structures defining the GMAT propagation options desired, including force models and the output coordinates. GMAT_EphemStandardParam is a script which takes the preceding lines to finish creating the inputs and defines the GMAT options desired. The script is only a sample of the options that are possible, but the creation of the Times variable is necessary for the following function call.

Here's a sample call:

- Code: Select all
`X0 = [9000 0 3000 0 7.53 2; % Initial Cartesian State [X Y Z VX VY VZ] Pos in km and Vel in km/s`

9000 0 3000 0 7.53 1.8;

9000 0 3000 0 7.53 1.6;

9000 0 3000 0 7.53 1.4];

runTrans = ones(size(X0,1),1);

startTimeMJD = runTrans*[53536];

runTimeDays = runTrans*[.2];

reportingSteps = runTrans*[30];

GMAT_EphemStandardParam;

[Ephem] = GMAT_EphemGenFunc_03(X0, Times, Spacecraft, ForceModel, Propagator, TempEphemLoc, reportFlag, CoordinateSystem);