# Fit Circle to Points

Hi!

I am trying to adapt the following code to different data sets.
https://root.cern/doc/master/fitCircle_8C.html For some data sets the fit works for some it
does not.

Trying to solve the problem I modified the parameters from this
double pStart[3] = {0,0,1};
to this
double pStart[3] = {0,0,0};
and it works better but still not very well.

Can anyone explain me why we need to initialize these parameters and why the third is initialized to 1 in the example?

Thanks!

Looking at the code it looks like the first two parameters are the coordinates of the circle centre and the third one its radius. May be for some of your data set the initial values 0,0,1 are too far from the result and the fitting procedure does not converge ?

Yeah, indeed, the fit does not converge for some of the data sets…
Is there any way I can apply a fit which be independent on such initial input?
I have way too many data sets in order to input manually the parameters…

How about the Coope method, is this implemented in ROOT?

Thank you!

I guess @moneta can answer better than me as he is our “fitting expert”.
Those which do not converge have centre different from (0,0) may be ?