# Unperturbed Earth-orbiting Satellite¶

This tutorial describes how to propagate the orbit of an unperturbed satellite about Earth using the MATLAB Interface, similar (but not identical) to the example Unperturbed Earth-orbiting Satellite written in C++. The code for this example can be found at:

tudatBundle/matlabInterface/Examples/Seamless/basicPropagation.m


The first step is to include the source code of the MATLAB Interface into MATLAB’s path in the current session so that all the classes needed to set up the simulation can be accessed. This is done by writing:

tudat.load();


Now, we create a Simulation object and specify the initial and final epochs:

simulation = Simulation();
simulation.initialEpoch = convert.dateToEpoch('1992-02-14 06:00');
simulation.finalEpoch = convert.dateToEpoch('1992-02-14 12:00');


Note that the function dateToEpoch from the convert package has been used. This function convert a date to seconds since J2000.

Next, we create the bodies. For an unperturbed orbit, the mass of the satellite is irrelevant, so we create a body named satellite with the following initial state:

satellite = Body('satellite');
satellite.initialState.semiMajorAxis = 7500e3;
satellite.initialState.eccentricity = 0.1;


Note that some of the Keplerian components have been omitted, and thus they are assumed to be zero. The semi-major axis cannot be omitted when providing a Keplerian state.

Now, we add the bodies to the simulation by calling the method addBodies of the simulation object. There exist predefined objects for celestial bodies (namely the Sun, the Moon and the eight planets), so these objects can be added directly without the need to specify their properties:

simulation.addBodies(Earth,satellite);


In this case, we use the pre-defined body Earth, which is basically a Body object named Earth with the property useDefaultSettings set to true.

Then, we create the settings for the propagation. We are going to propagate the translational state of the body satellite about Earth. Thus, we use a TranslationalPropagator:

propagator = TranslationalPropagator();
propagator.bodiesToPropagate = {satellite};
propagator.centralBodies = {Earth};


Now we need to specify the accelerations acting on satellite. The only accelerations are those caused by Earth, so we need to specify the property propagator.accelerations.satellite.Earth, which can be read as “accelerations on satellite caused by Earth”. In the case of an unperturbed orbit, the only acceleration is the point-mass gravitational attraction of the central body:

propagator.accelerations.satellite.Earth = {PointMassGravity()};


Finally, we add the propagator to the simulation object and define the integrator settings:

simulation.propagators = {propagator};

simulation.integrator.type = Integrators.rungeKutta4;
simulation.integrator.stepSize = 10;


In this case we use a Runge-Kutta 4 integrator with a fixed step-size of 10 seconds.

All the settings needed to run the simulation have been defined. Thus, we can write:

simulation.run();


This method creates a temporary input file and calls the json_interface application, generating a temporary output file containing the state of the satellite for each integration step. Then, it loads these results into the struct results of the simulation object. Finally, all the temporary files are deleted.

After running the simulation, if no specific results have been requested, we can obtain the numerical solution of the equations of motion from simulation.results.numericalSolution. This is a matrix containing in each row the results of an integration step. The first column contains the epochs, while the columns 2 to 7 contain the associated Cartesian states of the satellite.

We can use the results to generate a plot of the x, y and z components of the position of the satellite:

t = simulation.results.numericalSolution(:,1);
r = simulation.results.numericalSolution(:,2:4);
plot(convert.epochToDate(t),r/1e3);
grid on;
ylabel('Distance [km]');
legend('x','y','z','Location','South','Orientation','Horizontal');