How to specify the initial values for the parameters

Hi all,I am facing the following problem:How to initialize parameters when fitting functions with Chi2 Fits?Whether the initial value is arbitrarily given?But I don’t know anything about the range of initial values.

Thank you in advance!

Hi @DANTE0316,
I would point you to the users’ guide for fitting histograms, in particular section 7.2.2.2 Creating a TF1 with Parameters explains how to set the initial values for the parameters of the fitting function. Let me know if this helps you.
Best,
Vincenzo

Oh,I see,thank you Vincenzo!I do have one more question though,I know how to set the initial values for the parameters of the fitting function now 。This is my code:

TF1 *f1 = new TF1("f1","[0]*(((x+[1]*exp(-[2]*x*x)+[3]*exp(-[4]*x*x)+[5]+[6]*pow(1*x*x,[7]))*(x+[1]*exp(-[2]*x*x)+[3]*exp(-[4]*x*x)+[5]+[6]*pow(1*x*x,[7])))*exp(-(x+[1]*exp(-[2]*x*x)+[3]*exp(-[4]*x*x)+[5]+[6]*pow(1*x*x,[7]))/([8]+[9]*TMath::Log(1*x*x)+[10]*TMath::Log(1*x*x)*TMath::Log(1*x*x)+[11]*pow(1*x*x,[12])))/(2*([8]+[9]*TMath::Log(1*x*x)+[10]*TMath::Log(1*x*x)*TMath::Log(1*x*x)+[11]*pow(1*x*x,[12]))*([8]+[9]*TMath::Log(1*x*x)+[10]*TMath::Log(1*x*x)*TMath::Log(1*x*x)+[11]*pow(1*x*x,[12]))*([8]+[9]*TMath::Log(1*x*x)+[10]*TMath::Log(1*x*x)*TMath::Log(1*x*x)+[11]*pow(1*x*x,[12]))) +(([13]*exp(-[14]*x*x)+[15]*exp(-[16]*x*x)+[17]+[18]*pow(1*x*x,[19]))*1) *(([21]*exp(-(([22]*exp(-[23]*x*x)+[24]*exp(-[25]*x*x)+[26]+[27]*pow(1*x*x,[28]))*[29])*(x+[30])))+([31]*exp(-(([32]*exp(-[33]*x*x)+[34]*exp(-[35]*x*x)+[36]+[37]*pow(1*x*x,[38]))*[39])*(x+[30])))))",0,4500);

I don’t know anything about the range of 40 initial values,what should I do?Arbitrarily setting or other method?

Hi @DANTE0316,
The suggested way to go is that you should set the initial values of the parameters to their best estimate available. Then you can use SetParLimits to fix a value range in which the parameter can vary, otherwise it would be able to vary freely. This is explained in section 7.3.1 Fixing and Setting Parameters’ Bounds of the fitting guide I linked previously.
Best,
Vincenzo

I see.Thank you very much!