Hi
I want to do a linear fit on a TGraphErrors. Attached is the plot I have so far. I want to get rid of the line connecting my datapoints, and instead draw a straight line of best fit though my points.
I have made many attempts but I cant seem to find the correct method. Below is the code that makes the attached plot where l, bb,aa,bbE and aaE are predefined. Does anyone know of any tutorials or how to’s to help me with this linear fitting?
Thanks.
TGraphErrors *gr1 = new TGraphErrors (l, bb, aa, bbE, aaE);
gr1->SetTitle(“Temperature profile along loop”);
gr1->GetXaxis()->SetTitle(“Module”);
gr1->GetYaxis()->SetTitle(“Average Module Temperature C”);
TCanvas c1 = new TCanvas(“c1”,“Tprofile”,100,20,800,400);
c1->SetBorderMode(0);
gr1->SetMarkerColor(2);
gr1->SetMarkerSize(1);
gr1->SetMarkerStyle(21);
gr1->Draw("AC");