Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math.num-analysis.independent

Topic: Radius algorithm
Replies: 1   Last Post: Dec 5, 1996 8:17 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Dave Langers

Posts: 7
Registered: 12/12/04
Re: Radius algorithm
Posted: Dec 5, 1996 8:17 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Marcus wrote:

>Thank you for your help. What you have described is exactly what I'm
>currently doing, however its not very robust when noisy data is
>introduced into the algorithm. Do you know how to do a least squares
>fit of data to the equation of a circle? (I suppose: f(x,y)=x^2+y^2)
>I have a suspicion that this is a multivariate regression problem. I'm
>rather a newbie to this sort of thing.
>
>Thanks,
>Marc


Hello, it's me again! You told me that my solution to your problem was the
same as the one you were already using. Then I believe that your original
description was a bit wrong, but that won't help you any further. I spent
some time on a least squares method and I found one. I will not repeat the
derivation here since that would give me a headache typing it, but I will
give you the final result:

Suppose that you have datapoints (x1,y1), (x2,y2), ..., (xN,yN). Now form
the following sums:

M00 = N
M10 = x1+x2+...+xN
M20 = x1^2+x2^2+...+xN^2
M30 = x1^3+x2^3+...+xN^3

M01 = y1+y2+...+yN
M11 = x1*y1+x2*y2+...+xN*yN
M21 = x1^2*y1+x2^2*y2+...+xN^2*yN

M02 = y1^2+y2^2+...+yN^2
M12 = x1*y1^2+x2*y2^2+...xN*yN^2

M03 = y1^3+y2^3+...+yN^3

As you can see the first index of M gives you the power of the x's within
the summation, and the second one of the y's.

Now the quantities you want are the center (X,Y) of the circle and it's
radius R. They can be given by:

( + M00^2*M02*M30 - M00*M01^2*M30 + M00^2*M12*M02 - M00*M12*M01^2 + )
( - M20*M10*M00*M02 - M00*M02^2*M10 - M00^2*M21*M11 + M00*M21*M01*M10 + )
( - M00^2*M03*M11 + M00*M03*M01*M10 + M20*M01*M00*M11 + M02*M01*M00*M11 )
X = ---------------------------------------------------------------------------
2 * ( + M00^2*M20*M02 - M00*M01^2*M20 - M00*M10^2*M02 + )
( - M00^2*M11^2 + 2*M00*M01*M10*M11 )

( + M00^2*M21*M20 + M00^2*M03*M20 - M20^2*M00*M01 - M00*M20*M01*M02 + )
( - M00*M10^2*M21 - M00*M10^2*M03 - M00^2*M30*M11 - M00^2*M12*M11 + )
( + M00*M10*M11*M20 + M00*M11*M02*M10 + M10*M01*M00*M30 + M01*M10*M00*M12 )
Y = -----------------------------------------------------------------------------
2 * ( + M00^2*M20*M02 - M00*M01^2*M20 - M00*M10^2*M02 + )
( - M00^2*M11^2 + 2*M00*M01*M10*M11 )


R^2 = X^2 + Y^2 + M20/M00 + M02/M00 - 2*M10/M00*X - 2*M01/M00*Y

Now I hope I didn't make any mistakes typing it. I've checked this formula for
the data points (2,1), (-3,-4), (1,-2) and (-6,5). It does indeed give X=-3, Y=1
and R=5, as it should. I believe that my derivation is correct. Use it, try it
out and tell me when anything is wrong with it.

More greetings from Dave...





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.