Re: Circle Fit
- To: mathgroup at smc.vnet.net
- Subject: [mg38891] Re: Circle Fit
- From: crazymel at snail-mail.net (melanie)
- Date: Fri, 17 Jan 2003 05:39:20 -0500 (EST)
- References: <200212260934.EAA05128@smc.vnet.net> <auuabd$nkm$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
not sure if anyone is still reading this but i found:
For z = StartRow(w) To EndRow(w)
x = Sheet1.Cells(z, xCol).Value 'each xi
y = Sheet1.Cells(z, yCol).Value 'each yi
Sxxx = Sxxx + x ^ 3
Syyy = Syyy + y ^ 3
Sxxy = Sxxy + (x ^ 2 * y)
Sxyy = Sxyy + (x * y ^ 2)
Sxx = Sxx + x ^ 2
Syy = Syy + y ^ 2
Sxy = Sxy + (x * y)
Sx = Sx + x
Sy = Sy + y
Next z
A = N * Sxx - Sx ^ 2
B = N * Sxy - Sx * Sy
C = N * Syy - Sy ^ 2
D = 0.5 * (N * Sxyy - Sx * Syy + N * Sxxx - Sx * Sxx)
E = 0.5 * (N * Sxxy - Sy * Sxx + N * Syyy - Sy * Syy)
Xc = (D * C - B * E) / (A * C - B ^ 2)
Yc = (A * E - B * D) / (A * C - B ^ 2)
R = Sqr((Sxx - 2 * Xc * Sx + N * Xc * Xc + Syy - 2 * Yc * Sy +
N * Yc * Yc) / N)
to be really useful
given all xi, yi on a circle it spits back the radius (R) and center
(Xc, Yc)
more info at
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=35f59745.37468454%40news.wwnet.net&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DISO-8859-1%26q%3Dbest%2Bfit%2Bcircle%26meta%3D
from a IEEE PAMI paper by Thomas and Chan
http://www.cs.bsu.edu/homepages/math/people/regfac/kjones/circles.pdf
'A Few Methods for Fitting Circles to Data' by Dale Umbach and Kerry
N. Jones from Ball State university
melanie