Exponential fit

Hi everybody!!

I’m trying to fit a graph with a user function like a exponential, the code is this:

canvas = TCanvas(“canvas”,“canvas”, 1366, 725)
gPad.SetGrid()

gr1= TGraph(“2015.11.03-10.02.00_2015.11.03-11.19.00_ON_22.0_46000.0_BARC-8_Current.csv”, “%*s %*s %*s %*s %*s %*s %lg %lg”)

f= TF1 (“f”,"[a]* exp(x/[b])", 8000,10200)
f.SetParameters(0.1,40)

gr1.Fit(“f”,"","",8000,10200)
gr1.Draw(‘APL’)

The probelm is that I obtain this result:

So someone have an idea to how have a better fit?

Thanks a lot =)

Try: { TF1 *f = new TF1("f", "[0]*exp(x/[1])", 8000, 10200); f->SetParNames("a", "b"); f->SetParameters(1e-10, 555); // f->Draw(); }

Yes sure with the parameters optimized I obtain a better result but not the best…

Try simply:
gr1.Fit(“pol2”);