I want to fit data with my function with parameters which has dependence on energy such as a=a1+a2*ln(En). I have experimental data for each energy. So i can fit one set of data with function and define parameters a1 and a2 for one energy. Is it possible to do fit for all range of energy and find common parameters?



Yes, this is a standard minimisation process.

Put your data in a TH1, TGraph, TGraphErrors or like and use
the TH1::Fit, TGraph::Fit as shown in the tutorial FittingDemo.C


Hi, Rene,

Sorry for my explanation, but that not exactly that i need.
My function is f=f(x,a1=a1+a2ln(Energy),b1=b1+b2ln(Energy),… ), that is it has dependance on x and energy. And I have data points for same x for different energy. (I can fit them for certain energy when i fix it, but i want to find equal parameters for all set of energies.)
I have idea to create surface, where axis x is x, y is energy, and z is data. In this case, data points are on cut with certain energy. Then i would fit this surface with my function. Is it right, or is any another method to do it?



Hi ,

can you not express your funxtion f as a f (x, Energy, a1,a2, b1, b2) and then you keep as parameters a1, a2, b1 and b2 to be found by the fitting process and dependent variables x and Energy and you supply as fitting point all the P(x,Energy) you have ?
Let me know if I have mis-understood something,