Re: Fit x,y

Rene Brun (Rene.Brun@cern.ch)
Tue, 12 Aug 1997 14:04:31 +0200


Voropaev S.G. wrote:
>
> Hi.
>
> I want fit to line my data. I create 2 float array x[] and y[] and TGraph
> object:
> TGraph *tg = new TGraph(N, x,y)
> tg->Draw("AP")
> tg->Fit("pol1","","AP")
>
> and I see on window my data point and fitting line.
>
> Trouble:
>
> 1. I see very short line. For example, data X range is 0.4-0.7, but line X
> range is about 0.54-0.56.
> 2. When I work with big N (~50000), parameters of fitting line is not valid.
>
> What is wrong?
>

The current version of TGraph in version 1.02 assumes points ordered
along X. I have modified TGraph::Fit in the development version
to correctly compute the minimum and maximum along the X axis in case
of a set of unordered points.
Thanks for reporting the feature.

Rene Brun