[scilab-Users] Least squares fit to a circle

Vladímir Rodríguez vladimir.rodriguez at reduc.edu.cu
Tue Mar 23 14:51:00 CET 2010


El mar, 23-03-2010 a las 09:19 +0000, Mike Page escribió:
> Hello,
> 
> Does anybody have a good suggestion for fitting a circle to a set of
> experimental (x,y) data?  The data are measured electrically as a set of
> complex numbers and I want to find the centre and radius ([x0, y0, r]) of
> the circle that fits the data best in a least squared error sense.
> Typically the data spans somewhere between 0.2 and 1.0 radians of arc and is
> not very noisy (say 1%).
> 
> I have tried using the nonlinear solver fsolve, by defining a loss function:
> 
> L = (r^2 - (x-x0)^2 - (y-y0)^2)^2
> 
> and finding the vector [r, x0, y0] for which dL/d[r, x0, y0] is zero.  I
> have tried both with and without a Jacobian, but find that often the method
> fails to converge to a solution (maybe works 8 out of 10 times).
> 
> Next I tried the Box method of the Nelder Mead toolbox (I have constraints
> since physically, the centre has to be in the ++ quadrant of the complex
> plane).  This is better and always converges to a solution.  However, the
> solution is not always very good.  I can often fit a better circle by eye.
> 
> It may be that the algorithms are converging to a local minimum rather than
> the global one, but I don't know a good way to change this behaviour.  I
> seem to remember that simulated annealing was a way to solve this problem -
> does anybody know anything about that?
> 
> So, what I would like to know:
> 
> - Is there a better way than fsolve or Nelder Mead for fitting a circle to
> the data?
> - Is there a way to tune the performance that might give me a better fit?
> 
> I can post some code if it helps.
> 
> Thanks for any help.
> 
> Regards,
> Mike.
> 
If you can send the data (or a sample) I would like to try.
-- 
                      MSc. Vladímir Rodríguez Diez
                  Departamento de Ingeniería Eléctrica
                        Universidad de Camagüey




More information about the users mailing list