[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:fitting an ellipse

From: William Lash
Subject: Re:fitting an ellipse
Date: Sat, 21 Dec 2002 15:38:04 -0600

It's been a while since I have done any of this, but you could
use the pinv() function to do the fit.  I don't remember if
the psuedo-inverse is equivalent to a least squares fit, but
it will provide a fit for this case.

I would rewrite your equations as:


where the first row of z is x and the second is y, A is
the matrix [ a 0; 0 b], and the fist row of u is sin(t)
and the second is cos(t), e.g. if a is 2 and b is 1:

A=[2 0;0 1];

Now to get A from z and u, you can multiply each side
by the psuedo-inverse of u, leaving you with


Which in the case here, returns:

Aest =

    2.0000e+00    3.4534e-16
   -1.7144e-18    1.0000e+00

You could add some noise to z, since the observations will have
some noise:


and do the psuedo-inverse again:

Aest =

  2.0138864  0.0061711
  0.0089173  1.0124481

and then calculate the new data:


I guess the problem here is that you are not limiting the fit to
x=a*sin(t), but instead to x=a*sin(t)+a1*cos(t), and similarly for
y, so you may want to continue to look for something better.


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]