How to find an ellipse given a set of $x$ and $y$ values?

111 Views Asked by At

I have the function $f(x,y) = ax^2 + bxy + cy^2 + dx + ey + 1 = 0$, and have a set of 10 $x$ values and corresponding $y$ values where

$x = (x_1, x_2, ... x_{10})$

$y = (y_1, y_2, ... y_{10})$

And need to find values of $a,b,c,d,e$ that form an ellipse that all of these values (approximately) lie on. I can put all 10 $x$ and $y$ values into the function to get a set of 10 equations with 5 unknowns, but then how would I go about writing this in the form $Av = b$, where $v$ is the column vector $(a,b,c,d,e)^T$?

Vectors/matrices are not my strong point.

2

There are 2 best solutions below

0
On

Five equations suffice to fix the ellipse in position. Any five points determine an ellipse. So a lot of ellipse combinations$ (^{10} C_5)$ can be drawn.

If 10 points are given and you wish to use all of them equitably in the solution a least squares ellipse curve fit can be found by minimization of deviations.

0
On

You need to do some sort of least-squares fitting.

In other words, you take a variable ellipse, and you compute the sum of the squares of the distances from this ellipse to the ten points. You adjust the ellipse to make this sum-of-squares a minimum. The problem is difficult, because it's hard to even compute the distance from one point to an ellipse.

There is a rough outline of the mathematics in section 7 of this document.. The same web site also has C++ code. I haven't used this particular function, but I have used other software from this site, and found it to be very high quality.