Question

I don't know what am doing wrong.

amount={20,30,40,50,60,70,80,90,120,130,140,150,160,170,180,190,200}

capa={12,32,50,65,87,110,145,185,320,380,445,510,580,650,710,790,860}

data=Transpose[{amount,capa}]

nlm=NonlinearModelFit[data,A*(1-Exp[-b*x]),{A,B},x]

Using this I get overflow compilation error and nothing happens.

When I use the exact same fit in Origin or Matplotlib I get correct fit with A=-135and B=-0.01017.

Was it helpful?

Solution

As you could read on the Documentation page for the "General::ovfl" message you got, the problem here possible in bad starting values chosen by NonlinearModelFit. Let us try to specify better starting values:

nlm = NonlinearModelFit[data, a*(1 - Exp[-b*x]), {{a, -1}, {b, 0}}, x];
nlm["BestFitParameters"]

(*=> {a -> -134.847, b -> -0.0101706} *)

Right answer and no error messages.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top