# Orbit Elliptical Fitting

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 :)

• 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.
– uhoh
Mar 12, 2020 at 4:20
• 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.
– uhoh
Mar 12, 2020 at 4:23
• You can use elliptical regression. This require solving a minimization problem (minimize squared distante to ellipse) using ellipse parameters. See more here Mar 12, 2020 at 7:00
• 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. Apr 2, 2020 at 18:41
• I can visually see what you mean by that, thanks for pointing it out! Apr 4, 2020 at 10:15