[scilab-Users] Least squares fit to a circle

Stephane Mottelet stephane.mottelet at utc.fr
Tue Mar 23 19:12:00 CET 2010


Me again: the authors also gives an url pointing to Matlab sources of  
all the methods.

S.

Stephane Mottelet <stephane.mottelet at utc.fr> a écrit :

>
> Hi,
>
> there seems to be a bunch of different ways to fit a circle, did you  
> consider the various methods compared in this paper
>
> www.emis.de/journals/BBMS/Bulletin/sup962/gander.pdf
>
> ?
>
> S.
>
> Mike Page <Mike at Page-One.Waitrose.com> a écrit :
>
>> Hi Vladimir,
>>
>> Thanks for your email and your interest in this problem.  I have  
>> attached a CSV file with the experimental data in it.  Fitting a  
>> circle to the whole data set works OK, but if you look at the data,  
>> you can see a region of different curvature at the right hand side.  
>>  It is specifically this part that I want to fit to the nearest  
>> circle.  This is approximately the last 12 data points in the file.
>>
>> Let me know if you want me to send some code as well.
>>
>> Regards,
>> Mike.
>>
>>
>> -----Original Message-----
>> From: Vladímir Rodríguez [mailto:vladimir.rodriguez at reduc.edu.cu]
>> Sent: 23 March 2010 13:51
>> To: users at lists.scilab.org
>> Subject: Re: [scilab-Users] Least squares fit to a circle
>>
>>
>> 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
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com
>> Version: 9.0.791 / Virus Database: 271.1.1/2763 - Release Date:  
>> 03/22/10 07:33:00
>>
>>
>
>
>





More information about the users mailing list