# How to calculate the current position of a satellite?

I want to write a SIMULINK model that calculates the position visible of satellites for the current time.

As input for the model I have the coordinates of a location, the current time and the ephemeris/TLE data of satellites.

As output I want the angle and the distance to the satellite, from the given location.

So far, I have found the SGP4 model which is able to calculate predictions, for positions using TLE data and I also found a Website that does what I need and even more. Unfortunately I can't find any information on how they calculate that.

• You could look at the source code from the open source python packages Skyfield or PyEphem for example. I believe both are on github, and both are managed by the same person. The more accuracy you want, the more complicated the calculation is. If roughly one degree is OK you could assume the Earth is spherical and the math would be fairly easy, but the more reality you want to include, the more work is needed to get there.
– uhoh
Commented Sep 14, 2017 at 16:49
• Thanks, that sounds great, I don't need the calculations to be accurat. I will have a look at that. Commented Sep 14, 2017 at 17:01

Here is information on an open source Java package that has code for TLE propagation:

https://www.orekit.org/forge/projects/orekit/wiki/Tle

It also contains classes for all the components you need to get your range/angles to the satellite. Look at the topocentric frame interfaces in the javadoc; it's got interfaces to get the azimuth/elevation/range:

https://www.orekit.org/site-orekit-9.0/apidocs/index.html

It might be a bit easier to integrate your Matlab/Simulink with Java over python.

(full disclosure, I haven't used the package, but I believe it to be reliable)

• The OP has an SGP4 propagator already, and is looking for a way to calculate the look angles (elevation, azimuth) from a given location on the Earth. Does this do that?
– uhoh
Commented Sep 16, 2017 at 0:21
• Yes it does. It's a general-purpose library, so it has a lot of support for frame conversion and different state representations. I updated the answer to actually answer the question. Commented Sep 18, 2017 at 13:56
• +1 Looks good! I wouldn't recommend using python either, but the packages I mentioned are open-source wrappers for complied code (in various languages) which would have the algorithms and hopefully comments and references. No idea what's under the hood myself, but there must be something.
– uhoh
Commented Sep 18, 2017 at 14:03