Help fitting a polynomial + exponential not achieving the best results possible

I am trying to perform a fit to an exponential plus a polynomial. I get some good quick results using gnuplot. Which are the values found inside the initialParams found inside the C-macro.

If I set those as the initial parameters and let all the fit parameters run free, I do not get really good results.

Then, I decide to fix some limits to the exponential parameters, using:


You will see those lines commented inside the C-macro. It is a bit strange that I observe in the fitting results the following:

p0                        = -9.25005e-06                      	 (fixed)
p1                        =   0.00186612   +/-   7.44872e-09  	 (limited)

Although I just limited and not fixed parameter p0.

The result seems a bit better although not perfect in all the range.

If I fix the two exponential parameters then I get the result I expect, even if I let free the polynomial parameters:

I really need to automatize this process for similar curves, so I need to solve this problem. The biggest suspect for me is why the p0 parameter is fixed even if I just used SetParLimits.

BxFit_0.C (2.4 KB)
outFinal_Xp.txt (16.2 KB)

I guess @moneta can help

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.