ROOT Version: 6.20/02
_Platform:
_Compiler: gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
Hello everyone!
I have some data in a .txt file and I want to have a quadratic fit.
I know that my data does not seems to match so much with this fit (However I want this fit. I run the code many times with different data, so i tried to have the best starting point for my data, that’s why I have these numbers at SetParameters ).
When I do the fit in excel or mathematica (with the same data) I have different parameters from those found in root! I can not understand why!
Hi,
depending on the exact fitting algorithm results might be different, especially for fits that are expected to be bad. It could also be a local optima behavior. @moneta might be able to comment further.
It is true that Minuit does not work very well with that data, this is caused by some numerical error.
It is true If you run the linear fitter (default for polynomials if you don’t use the B option), you get a better result, probably the same in Mathematica.
For doing a linear fitter do:
MyGraph1->Fit(f2,"");
However, I would translate the x value and define better the function to minimise the numerical error and have parameters which do not have such large values. I would fit a function defined as:
TF1 * f2 = new TF1("f2","[a]*(x-80.)*(x-80.)+[b]*(x-80.)+[c]");
Hi,
You can figure out from the plot, but (since it is a polynomial) you can try from {1,1,1}.
Note, that if using the linear fitting you don’t need to set initial values