Function has exponential term, therefore chisquare is divergent.
I removed one exponential term,
" function = par[0]*exp(-x/par[1]) + par[2] "
This reduced function is divergent too.
In the case of single exponential,
" function = par[0]*exp(-x/par[1]) "
I can make linear function with log form, therefore I can fit very easily.
In my case, how can I fit ?? Is there any comment?
I also get this strange message about “abnormal termination” from time to time.
It even happens when the initial values of parameters are close to the “real ones” but as soon as I set them to a rather “crazy” values, the fit converges.
Well, it may sound weird but, it really helps when one significantly changes initial values of parameters.
So, try to play with them.
Maybe changing the order of parameters would help, too (but I haven’t tried it in my case).
Something like:
function = par[0]+par[1]*exp(-x/par[3])+par[2]*exp(-x/par[4])
I tried to fit data with the suggested function of
function = par[0]+par[1]*exp(-x/par[3])+par[2]*exp(-x/par[4]).
But, I got same messages whenever I fit.
I think that this function can’t fit data with mathematical reason.
(y - y_offset )=N0*exp(-x/t)
Because of y_offset, this function can have large mount of fit parameters.
In addition, those parameters can have good Chisquare.
Therefore, fitting algorithm can’t minimize chisquare.
you should set the initial fit parameters to values as close as possible to the fitted ones. You might also try to
constraint some of them to avoid to go in non-physical regions. Also sometimes one can try to fix first some of the parameters to reasonable value, and then re-fit later leaving them floating.