Hi experts.

I have a problem when i use the pol1 fitter.

I want to fit the three coordinates I entered.

This is the code i used.

double pol1(Double_t *x, Double_t *p);

void fixcal()

{

TCanvas *c = new TCanvas(“c”,“c”,1200,900);

c->SetGrid();

c->GetFrame()->SetFillColor(21);

c->GetFrame()->SetBorderSize(12);

const Int_t n = 3;

Double_t x[n] = {

1.30217e+05,

1.81170e+05,

1.90896e+05

};

Double_t y[n] = {

59.5,

81,

88

};

Double_t ex[n] = {

2.63060e+01,

7.45597e+01,

1.49197e+02

} ;

Double_t ey[n] = {

0,

0,

0

};

TGraphErrors* g = new TGraphErrors(n,x,y,ex,ey);

g->SetMarkerColor(8);

g->SetMarkerStyle(21);

g->Draw(“ALP”);

g->Draw(“same”);

g->GetXaxis()->SetRangeUser(0,2.0e+05);

g->GetYaxis()->SetRangeUser(0,90);

g->GetXaxis()->CenterTitle();

g->GetXaxis()->SetTitle(“ADC”);

g->GetYaxis()->CenterTitle();

g->GetYaxis()->SetTitle(“Energy(keV)”);

TF1 *fit = new TF1(“fit”, pol1, 0, 1.91e+05, 2);

g->Fit(fit,“r”);

fit->SetLineColor(4);

fit->Draw(“same”);

TF1 *cal_am = new TF1(“cal_am”, pol1, 0, 1.91e+05, 2);

cal_am->SetParameters(0, y[0]/x[0]);

cal_am->SetLineColor(2);

cal_am->Draw(“same”);

}

double pol1(Double_t *x, Double_t *p)

{

return p[0]+p[1]*x[0];

}

And the result show’s like this.

Warning in : Abnormal termination of minimization.

FCN=0 FROM MIGRAD STATUS=FAILED 100 CALLS 101 TOTAL

EDM=1.28169e+08 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 100.0 per cent

EXT PARAMETER APPROXIMATE STEP FIRST

NO. NAME VALUE ERROR SIZE DERIVATIVE

1 p0 0.00000e+00 1.41421e+00 -0.00000e+00 0.00000e+00

2 p1 0.00000e+00 3.49162e-28 0.00000e+00 -3.24238e+31

How can i solve this problem?

*Please read tips for efficient and successful posting and posting code*

*ROOT Version:* Not Provided

*Platform:* Not Provided

*Compiler:* Not Provided