Regarding the Fitting

I wanted to fit my data with that of power fitting.How can i do that by writing the command and also directly from the fit panel of the canvas? since i didn’t find the option of doing that in the fit panel as well.

Hi,

Suppose you want to fit an histogram, which you have called h1, with a function
f(x) = A * x + b.

auto f1 = new TF1("f", "[A]*x + [B}");
h1->Fit(f1);

If you want to use the FItPanel, you have a text field where you can enter your own function or use some pre-defined functions.

More information is available in the Fitting chapter of the user guide

https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#fitting-histograms

and you can find examples in the tutorials/fit directory

Lorenzo

suppose i want the power fit of the form: y=Ax^c,where i want to know c from the fit,i.e how its varying with x.
here in my case,its dev=A*(rigidity)^c. my command is written as:

{TNtuple calls(“calls”,“calls”,“dev:rigidity”);
calls.ReadFile(“ev7.dat”);

TCanvas *alpha1 = new TCanvas(“alpha1”,“canvas”);
calls.Draw(“dev:rigidity”);

alpha1->SetFillColor(42);

auto z1 = new TF1(“dev”, “[A]*[rigidity]^[c]”);

alpha1->Fit(z1);

}

now,what’s wrong in this,can you correct that pls? since i din’t find it.

Hi,

this is a dupe of Regarding the fit of the data

Cheers,
D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.