Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Ellipse Fitting
Date: Thu, 4 Dec 2008 06:50:20 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <gh7ujc$qlc$1@fred.mathworks.com>
References: <984e419b-b5fd-4acb-bf80-bcb09dffcce6@v15g2000yqn.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228373420 27308 172.30.248.37 (4 Dec 2008 06:50:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 4 Dec 2008 06:50:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:504889


djordjep@gmail.com wrote in message <984e419b-b5fd-4acb-bf80-bcb09dffcce6@v15g2000yqn.googlegroups.com>...
> Hello all, i have a problem with ellipse fitting experiment i'm trying
> to do for my class:
> ........

  Here's one approach you might consider.  Assuming you are in two dimensional space, any ellipse can be described by the equation

 A*x^2 + B*x*y + C*y^2 + D*x + E*y + F = 0

with appropriate values of A, B, C, D, E, and F.  If x, y, and z are column vectors of the three corresponding coordinate of your data points, form the matrix M:

 M = [x.^2,x.*y,y.^2,x,y,ones(size(x))];

Then use the singular value decomposition function:

 [U,S,V] = svd(M,0);

The sixth (last) column of V will contain the least squares values of [A;B;C;D;E;F] subject to the restriction that the sum of their squares is one.  (This latter is necessary because the ellipse's equation is homogeneous in the six coefficients.)

  For many (but not all) point sets this can be considered a "best" fit to an ellipse.  One drawback it possesses is that this solution does not remain strictly invariant with respect to translations of the coordinate system.

Roger Stafford