Fit x,y [2]

Voropaev S.G. (voropaev@inp.nsk.su)
Sun, 10 Aug 1997 13:27:00 +0700


Hi,
I investigate my problem. New example:

float x[20], y[20];
for(int i=0; i<20; i++) {x[i]=(i+1)/21.0; y[i]=0.5*x[i]+0.2;};
c1 = new TCanvas("c1","proba");
TGraph *tg = new TGraph(20,x,y);
tg->Draw("AP");
tg->Fit("pol1"); // All is OK. I see all my point and long line.

for(int i=0; i<20; i++) {x[i]=gRandom->Rndm(1); y[i]=0.5*x[i]+0.2;};
delete tg;
TGraph *tg = new TGraph(20,x,y);
tg->Draw("AP");
tg->Fit("pol1");

Now I see all my point and very short line. The X range of line is 0.1-0.2!

Question: Can I fit non-sorted x,y data point?

ROOT Version 1.02/00 1 August 1997
intel PC, Windows NT 4.0

Voropaev S.G.