Hi Stephanie, Note that the option "B" does (did) not exist in TGraph::Fit. When fitting with predefined functions like poln,expo,gaus, the inititial values of the parameters are automatically computed. However, some time it may be useful to switch off this automatic computation. I have added an option "B" in TH1::Fit and TGraph::Fit to disable this automatic initial values. The new option is now in CVS. Rene Brun On Thu, 15 Feb 2001, S. Escoffier wrote: > Dear Rooters, > > I would like to report a bug in fitting a TGraphError: > If I fit a TGraphError with a polynomial function, with the parameter 0 fixed > to 0. , > then results are not in agreement with initials values. I mean, p0 is well > fixed, but not equal to 0. > If function f1 is described by > TF1 *f1 = new TF1("f1","[0]+[1]*x",0.,5.); > then it works. > > I'm working with 2.23.12 version on UNIX system. > Sorry if this problem has been already reported. > > Stephanie. > > > void test() > { > Float_t x[4]={1.,2.5,3.5,4.75}; > Float_t ex[4]={0.01,0.01,0.01,0.01}; > Float_t y[4]={0.,1.,2.,3.}; > Float_t ey[4]={0.01,0.01,0.01,0.01}; > > TGraphErrors* g1 =new TGraphErrors(4,x,y,ex,ey); > > TF1 *f1 = new TF1("f1","pol1",0.,5.); > f1->SetParameter(0,0.); > f1->SetParLimits(0,1,1); > > TCanvas* c1; > c1 = new TCanvas("c1","c1",100,10,800,500); > c1->cd();gStyle->SetOptFit(111); > g1->Draw("AP"); > g1->Fit("f1","B"); > > } > > Print on screen: > > FCN=2442.08 FROM MIGRAD STATUS=CONVERGED 18 CALLS 19 TOTAL > EDM=4.66971e-08 STRATEGY= 1 ERROR MATRIX ACCURATE > > EXT PARAMETER STEP FIRST > NO. NAME VALUE ERROR SIZE DERIVATIVE > 1 p0 -2.75862e-01 fixed > 2 p1 6.47669e-01 1.72543e-03 4.16384e-05 -1.77117e-01 > >
This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:09 MEST