File Exchange

image thumbnail


version (9.72 MB) by Meysam Mahooti
The SGP4 model to calculate orbital state vectors of near-Earth satellites


Updated 02 Apr 2020

View License

Simplified perturbations models are a set of five mathematical models (SGP, SGP4, SDP4, SGP8 and SDP8) used to calculate orbital state vectors of satellites and space debris relative to the Earth-centered inertial coordinate system. This set of models is often referred to collectively as SGP4 due to the frequency of use of that model particularly with two-line element sets produced by NORAD and NASA. These models predict the effect of perturbations caused by the Earth’s shape, drag, radiation, and gravitation effects from other bodies such as the sun and moon. Simplified General Perturbations (SGP) models apply to near earth objects with an orbital period of less than 225 minutes. Simplified Deep Space Perturbations (SDP) models apply to objects with an orbital period greater than 225 minutes, which corresponds to an altitude of 5,877.5 km, assuming a circular orbit.
The SGP4 model was developed by Ken Cranford in 1970. This model was obtained by simplification of the more extensive analytical theory of Lane and Cranford which uses the solution of Brouwer for its gravitational model and a power density function for its atmospheric model.

Cite As

Meysam Mahooti (2020). SGP4 (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (25)

Murat Bulut

Hung Nguyen

If I want "tsince" to be in seconds, what do I need to change in the code? So far, the results (in ECEF) seem to be consistent with an orbital tool we're using for one-day run on a GPS TLE, within (-0.7,+0.6) in range, and (-3e-4,+5e-4) in velocity magnitude. Thanks for the code.

Hung Nguyen

Hi Meysam, do you have MATLAB code for SDP4 (orbital period greater than 225 minutes) model? If not can you give some pointers? Thanks

Dear Charith,
You will get your answer by reading the following paper:
Best regards,

Dear Meysam, I just used your code and its work accordingly amazing work, and thank you. How do I interpret the equinox coordinate system it has provided me? Im trying to get some rough calculations done for a CubeSat comms subsystem and I'm unsure how to use the result of the SGP4 code.

Dear Zhang,
You can download Earth orientation parameters (EOP) from the following link:
Best regards,


Where can I download IERS data? PLease send me the link . Thank you very much!


A good job!

The output of SGP4 by Vallado is based on equator mean equinox (TEME) coordinate system. Please compare your results with STK. Moreover, I am not sure STK has considered what type of coordinate system. I suggest use my version rather than Vallado's version.

Changyong He

Clear code! However, note that the output of spg4 is different from the sgp4 propagator written by Vallado. I cannot find the reason because there are no comments in your code.

Nowhere in code, comments, or (absent) readme are units or coordinate systems specified, which creates a tremendous amount of unnecessary work for any user.

Dear Meysam, do you know why the results of sgp4 and STK are different?
(i tried sgp4 in Matlab,Python and C++ all of them had same result but different from STK!)

Dear Meysam kindly tell me what tsince actually is? is it the time since epoch of the satellite or something else and also how to calculate tsince for a particular yy/mm/dd h:m:s

tsince in test_sg4.m is amount of time in minutes which you are going to propagate satellite's state vector forward (+) or backward (-).

Aakash Deep

Can you explain what is tsince in your code?

Thanks for the upload! I was wondering why the sgp4 function does not work when I use an eccentricity of zero? In order to get it to work for circular orbits, should I just use a very small eccentricity to approximate a circular orbit? My inclination, RAAN, eccentricity, argument of perigee, mean anomaly, mean motion, and revolution number at epoch are:
96.8500 217.5000 0000001 0.00000 0.000000 15.68820425 000


Thanks for the upload. How can I take time in consideration in order to propagate the satellite orbital position and velocity?


test_sgp4.m is modified.

Satellite's state vector is computed in four different coordinate systems, i.e. Earth-centered inertial (ECI), Earth-centered Earth-fixed (ECEF), true of date (TOD) and true equator mean equinox (TEME).


MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: epoch2datevec(tle_epoch)