Question: Given a set of XYZ (3D) coordinates in the Earth-fixed frame, after converting them to the inertial frame, how do I perform orbit fitting in the least-squares sense (meaning minimising all least squares residuals below)? My objective is to come up with an orbit ellipse (6 elements) that best-fits those points such that the L2-norm of the residuals are minimised, but I'm not sure where I should start... I know there are programs and software out there to do it, but I'd like to try to make my own :)

enter image description here

  • 1
    $\begingroup$ Interesting question! One example of a problem like this (set of coordinates in the Earth-fixed frame) might be something like reverse-engineering a ground-track lat/lon plus altitude dataset to Keplerian elements (and then one might think "Why stop there?" and back into an artificial TLE). I suppose if you already have the XYZ converted to ECI you could either vary the Keplerian elements or choose a cartesian expression, fit that, then convert to Kelperian. Ideally they'd produce the same results, but in practice one might work better with one fitting algorithm, and the other with another. $\endgroup$
    – uhoh
    Mar 12, 2020 at 4:20
  • 1
    $\begingroup$ I noticed that you omitted the times of the data points which makes the task easier, but if the data were available it might be a better choice in practice to use it. Of course then you need a propagator, and then the orbits are not perfect ellipses, and... etc. $\endgroup$
    – uhoh
    Mar 12, 2020 at 4:23
  • 5
    $\begingroup$ You can use elliptical regression. This require solving a minimization problem (minimize squared distante to ellipse) using ellipse parameters. See more here $\endgroup$
    – Manu H
    Mar 12, 2020 at 7:00
  • 1
    $\begingroup$ One word of warning: If you have less that about half an orbit, there can be significant numerical stability problems that will lead to massive uncertainty in the semi-major axis. $\endgroup$ Apr 2, 2020 at 18:41
  • $\begingroup$ I can visually see what you mean by that, thanks for pointing it out! $\endgroup$
    – Samuel Low
    Apr 4, 2020 at 10:15

1 Answer 1


What you are looking for is called orbit determination, and in particular batch least squares orbit determination.

To learn about it I can recommend Statistical Orbit Determination by Bob Schutz, Byron Tapley and George H. Born.

I understand that you want to try to do it yourself. Nevertheless, if at some point you are looking to do it with software, it is not very complicated either. Here is an example with Orekit: https://nbviewer.jupyter.org/github/GorgiAstro/orbit-determination-examples/blob/a5b592656cadb411f7edafdf15e16d8b3ca3eeaa/01-keplerian-od-with-iod.ipynb [disclaimer: I am the author of this example]. It demonstrates:

  • Initial Orbit Determination (IOD) using Gibbs method using three position vectors, which is necessary if you don't have any clue about the orbit, because the Batch Least Squares estimation requires a first guess
  • Batch Least Squares (BLS) estimation

Noisy measurement points vs IOD vs BLS

  • $\begingroup$ Thank you! I'll try it out, and good recommendation for the textbook! $\endgroup$
    – Samuel Low
    Mar 12, 2020 at 14:07
  • $\begingroup$ Thank you once again for pointing me in the right direction, I realised I forgot to mark your answer as correct - there it is! $\endgroup$
    – Samuel Low
    Mar 17, 2020 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.