Subscribef(x0, y0, R) = sum[(sqrt{(x0-xi)^2+(y0-yi)}-R)^2]You can probably tell from all the brackets that this isn't a linear problem, so you have to solve it iteratively. The fastest and most reliable nonlinear least-squares algorithm is the Levenberg Marquardt method, of which you can find free implementations in Fortran, and Python, C (and probably other languages).
f = sum[(xi - x0)^2 + (yi-y0)^2 - R^2)^2]This is called the "Algebraic Fit", and it can be reduced to a linear function which you can solve in one step by inverting a matrix. Careful, if your points are not evenly distributed this method will bias your center point towards the denser points.
You are not logged in, either login or create an account to post comments
posted by plinth at 7:22 AM on May 20, 2006