31 "Fitting 3 TGraphErrors with linear functions");
35 makePoints(
n,
x,
y,
e, 3);
45 makePoints(
n,
x,
y,
e, 2);
57 TF1 *f2 =
new TF1(
"f2",
"sin(x) ++ sin(2*x)", -2, 2);
64 makePoints(
n,
x,
y,
e, 4);
71 gre4->
Fit(
"1 ++ exp(-x)");
79 leg->AddEntry(gre3,
" -7 + 2*x*x + x*x*x",
"p");
80 leg->AddEntry(gre2,
"sin(x) + sin(2*x)",
"p");
81 leg->AddEntry(gre4,
"-2 + exp(-x)",
"p");
93 x[i] =
r.Uniform(-2, 2);
100 x[i] =
r.Uniform(-2, 2);
101 y[i] = -7 + 2*
x[i]*
x[i] +
x[i]*
x[i]*
x[i]+
r.Gaus()*0.1;
106 for (i=0; i<
n; i++) {
107 x[i] =
r.Uniform(-2, 2);
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
A TGraphErrors is a TGraph with error bars.
TF1 * GetFunction(const char *name) const
Return pointer to function with name.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
Fit this graph with function with name fname.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
This class displays a legend box (TPaveText) containing several legend entries.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
This is the base class for the ROOT Random number generators.