Hi,
I have a TGraph2D which follows a non-standard function. I’d like to fit the area that is around the minimum of this TGraph2D with a paraboloid:
z = (x-x0)^2/a^2 + (y-y0)^2/b^2 +z0
My code looks like:
TGraph2D *g = new TGraph2D(nDataFiles,th,ph,zh);
g->Draw("surf1");
TF2 *paraboloid = new TF2("paraboloid","pow(x-[0],2)/([2]*[2]) + pow(y-[1],2)/([3]*[3] +[4])",xmin-15.,xmin+15.,ymin-60.,ymin+60.);
paraboloid -> SetParameters(45.,180.,1.,1.,100.);
paraboloid -> SetParNames("x0","y0","a","b","offset");
gStyle -> SetOptFit(1111); //To add fit parameters to plot legend
g-> Fit("paraboloid","RMLL");
paraboloid->Draw("same");
The problem is that the fit is totally “unstable”. It only converges when I initialize z0=1, and in this case it gives completely wrong values from the fit for z0. When I put z0=100 (that is actually quite close to the value it actually has), the fit does not converge at all.
Is is possible to set somehow the tolerance of the fit, or do something to make it more stable?
Any hint of what could be the reason that the whole fit procedure is so sensible to the initial parameters?
I guessed that not having enough
Thanks,
Estela.