Hi all,
I have a set of data points, say probability vs energy, that I interpolated with TSpline3. Now, I want to use this interpolation as a function so that I can multiply it with another TF1 function, say power law, and use this combined function to fit a set of another data points. But I don’t know how to use interpolation as a function. I tried to use sp->Eval(x) inside TF1 like “sp->Eval(x) * [0] * x**[1]” but it’s not working? Any help is greatly appreciated.
Thanks for your prompt reply @Wile_E_Coyote. As I understand, you defined a function using ‘[=]’ instead of a name, passed pointers x and p as arguments and used min and max x values of the interpolation. Have I understood it correctly? And, does the number 2 in the last stands for two parameters?
Thanks. I have a doubt! I think we need to use the min and max of the data points that I want to fit with this combined function, instead of min and max of the interpolation function as you suggested with sp->GetXmin() and sp->GetXmax(). Is it so?
@Wile_E_Coyote I tried your suggestion. the errors on the parameters looks fine, I guess. But the value of P2 is very large, 10^7 !! (Image1)
Also, I tried fitting it with one more function but it seems I can’t (image 2)! As a comparison I used fitting in python using ODR (image 3), but the error in the parameter P2 is very large (image 4)!
Any suggestions?
Also, is it necessary to consider errors on x axis. How does it affect the fit if we neglect it?