Biexponential fit

Hi!

I am trying to fit a data group by a biexponential fit, but I have a problem
because I can’t find the form to introduce boundaries, to parameter A1 and A2
of the next equation:
y=A1exp(-C1t)+A2exp(-C2t) where A2=100-A1 and y(t=0)=A1+A2 (boundary).

If you can help me, I appreciate too much your answer.

The code is it:

{
//=================================================
// Caja Costarricense de Seguro Social
// Hospital San Juan de Dios
//
// Ajuste biexponencial para calculo de tiempos
// de residencia de 131I
//
//=================================================

gROOT->Reset();
gROOT->SetStyle(“Plain”);
gStyle->SetOptFit(111);

//Puntos de ajuste

Double_t x1[6] = {0,2.1,20.6,44.4,68.4,92.0}; //cuerpo
Double_t y1[6] = {100.0,99.27,38.87,10.14,3.65,1.35}; //cuerpo

Double_t x2[6] = {0,2.3,20.7,44.7,68.6,92.3}; //Sangre
Double_t y2[6] = {100.0,8.52,3.47,1.02,0.92,0.21}; //Sangre

//Double_t y[6] ={55,53.86,44.76,35.28,27.75,21.92}; //Monoexponencia
prueba C1=55 C2=0.01
//Double_t y[6] ={100,44.79,5.735,0.531,0.048,0.005}; // Biexponencia
prueba C1=45 C2=0.1 C3=55 C4=0.9

//Declara las graficas
TGraph *graph1 = new TGraph(6, x1, y1);
TGraph *graph2 = new TGraph(6, x2, y2);

//Dibuja las graficas en nuevas canvas
TCanvas* c1 = new TCanvas (“Canvas”,“Curva de retencion 1- Cuerpo 2-
Sangre”,840,840);
c1->Divide(1,2);
c1->cd(1);
c1->SetTicks();

graph1->GetXaxis()->SetTitle(“Tiempo (horas)”);
graph1->GetYaxis()->SetTitle(“Porcentaje de retención en cuerpo(%)”);
graph1->GetYaxis()->SetTitleOffset(1.2);
graph1->SetMarkerStyle(20);
graph1->SetMarkerSize(0.7);
graph1->SetMarkerColor(1);

graph2->GetXaxis()->SetTitle(“Tiempo (horas)”);
graph2->GetYaxis()->SetTitle(“Porcentaje de retención en sangre(%)”);
graph2->GetYaxis()->SetTitleOffset(1.2);
graph2->SetMarkerStyle(20);
graph2->SetMarkerSize(0.7);
graph2->SetMarkerColor(1);

// Declarar funcion de ajuste cuerpo
TF1 *l1 = new
TF1(“l1”,"[0]*exp(-[1]*x)+[2]*exp(-[3]*x)",x1[0]-100,x1[6]+100);
l1->SetLineColor(2);
graph1->Fit(“l1”,“R”);
graph1->Draw(“AP”);

c1->cd(2);

// Declarar funcion de ajuste sangre
TF1 *l2 = new
TF1(“l2”,"[0]*exp(-[1]*x)+[2]*exp(-[3]*x)",x2[0]-100,x2[6]+100);
l2->SetLineColor(4);
graph2->Fit(“l2”,“R”);
graph2->Draw(“AP”);

//Escribe parametros y chi2
printf("\nDatos de cuerpo\n");
printf("\nAJUSTE DE LA FUNCION: y=C1Exp(-C2x)+C3Exp(-C4x)\n");
printf(“C1= %4.6f\n +/- %4.2f\n”,
l1->GetParameter(0),l1->GetParError(0));
printf(“C2= %4.6f\n +/- %4.2f\n”,
l1->GetParameter(1),l1->GetParError(1));
printf(“C3= %4.6f\n +/- %4.2f\n”,
l1->GetParameter(2),l1->GetParError(2));
printf(“C3= %4.6f\n +/- %4.2f\n”,
l1->GetParameter(3),l1->GetParError(3));
printf(“chi2 / ndf: %f / %d\n”,graph1->GetFunction(“l1”)->GetChisquare(),
graph1->GetFunction(“l1”)->GetNDF());

printf("\nDatos de Sangre\n");
printf("\nAJUSTE DE LA FUNCION: y=C1Exp(-C2x)+C3Exp(-C4x)\n");
printf(“C1= %4.6f\n +/- %4.2f\n”,
l2->GetParameter(0),l2->GetParError(0));
printf(“C2= %4.6f\n +/- %4.2f\n”,
l2->GetParameter(1),l2->GetParError(1));
printf(“C3= %4.6f\n +/- %4.2f\n”,
l2->GetParameter(2),l2->GetParError(2));
printf(“C3= %4.6f\n +/- %4.2f\n”,
l2->GetParameter(3),l2->GetParError(3));
printf(“chi2 / ndf: %f / %d\n”,graph2->GetFunction(“l2”)->GetChisquare(),
graph2->GetFunction(“l2”)->GetNDF());
:? :?

please post your code using the “code” option or as an attachment

Rene

Hi,

see TF1:SetParLimits(), root.cern.ch/root/html/TF1#TF1:SetParLimits

Cheers, Axel.