I am trying to find a least-squares ellipse fit for a set of 100 data points $(x,y)$.

Now I have found the values of $A,B,C,D,E,F$ according to the conical equation of the ellipse $$ Ax^2+Bxy+Cy^2+Dx+Ey+F=0 $$ I would like to know how to find the points that actually lie on this ellipse. From my basic understanding, if I substitute a value of $x$ in the above equation, it should give me the corresponding value of $y$.

When I do the above, I get a straight line and not really a fitted ellipse. How can I find the fitted ellipse?

My task is to plot these points so that I can see the best possible fit. For reference see [link]. This is the source of ellipse fitting that I am currently using.

I appreciate help from anyone who has experience with this. I am sorry if I am lacking some basic mathematical knowledge, but from what I understand, it isn't all that straightforward.



  • $\begingroup$ Try to google "fitting the ellipse" and maybe this will help: cs.cornell.edu/cv/OtherPdf/Ellipse.pdf $\endgroup$
    – user35603
    Aug 13, 2014 at 10:55
  • $\begingroup$ Formulas look there. Or choose other. math.stackexchange.com/questions/809907/… $\endgroup$
    – individ
    Aug 13, 2014 at 11:15
  • $\begingroup$ "I get a straight line and not really a fitted ellipse" - This doesn't sound right. What were the parameters? What values of x did you use? Can you post how you found the y values? They are not linear in x unless A,B,C are small relative to the other params, I think? $\endgroup$ Aug 13, 2021 at 11:32

1 Answer 1


A sure way to determine whether a point lies on the ellipse is to substitute the point's x- and y-coordinates into the equation and see whether the equation is exactly satisfied. (Your method is also valid, but requires more work.)

An example of how to use MATLAB to plot a curve and points is at https://www.mathworks.com/help/curvefit/fit.html. You will need to solve your equation for y. Be careful, though, because a point may appear to be on the ellipse but actually not be on it.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .