Fit Panel -- problems fitting with a user function

So I am trying to use the good old Fit Panel to fit a times series data with an exponential distribution.
First of all, when I set the range using the slide bar at the bottom the limits on the graph do not show up anymore (as they used to). This was a very useful feature, and I do not understand why it was removed (or if its broken then needs to be fixed?).

But the bigger problem is the following If I select “expo” from the drop down menu it fits the data totally fine. See screenshot.

Great, right?
However if I select my own function – another exponential – the fit sets all the parameters to zero.

Yes, I can go and set the initial values close enough to the real thing, and the the fit works – however that is absurdly tedious, and essentially partially defeats the purpose of the fit!

Is there a workaround? I mean it’s 2020, it shouldn’t be so hard to do a quick fit, right? Especially for ROOT, right?

Areg

p.s. here’s the definition of the function I am using for fitting:

TF1 *f=new TF1("f","[0]*pow(2,([1]-x)/[2])",140,175)

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.20/04
Platform: Catalina
Compiler: Not Provided


May be @moneta can help you.

1 Like

From the second screenshot, I can see that the values of all three parameters of your function are 0 … but …

@Wile_E_Coyote, I do know this - and I have been doing this for years. I just wandered whether there are some functionalities in ROOT that will help one “guess” those initial values for an arbitrary function, just as there are similar “guesses” for such built-ins as Gaus etc. Again, it’s 2020, not 1970…most other codes (matlab, numpy etc) have this.

I don’t think that “smart guessing” can be coded for arbitrary fit functions.

Looking at the form of your function, I think you should make sure that the initial values of “p0” and especially “p2” are nonzero (e.g. try to set them to 1).

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