Fitting parameters

Hi ROOTers,

I’m trying to fit a TGraphErrors with a function (quite complicated) which has 4 parameters, each with its bounds.
This is what I get:

Error in ROOT::Math::ParameterSettings>: Invalid lower/upper bounds - ignoring the bounds

What is it due to?

Cheers,

Manuel

Hi,
I suppose that you use SetParLimits method. In fact I wrote simple macro:

#include <TRandom.h> #include <TF1.h> #include <TH1D.h> Double_t fit(Double_t *x, Double_t *params){ return params[0]*TMath::Exp(-(x[0]-params[2])*(x[0]-params[2])/params[1]); } void root_t(){ TH1D *h = new TH1D("a","a",1000,-1,1); for(int i=0;i<10000;i++) h->Fill(gRandom->Gaus(0.4,0.3)); TF1 *f = new TF1("g",fit,-10,10,3); f->SetParLimits(0,10,1000); f->SetParLimits(2,0.3,0.9); f->SetParLimits(1,0.1,0.9); h->Fit(f); h->Draw(); }
This code generate the same warning, what is more important they works because without f->SetParLimits I can’t properly fit my histogram. So this “ignore warning” its a lie, I suggest ignore this :smiling_imp: .