# Fit exponential convergence

I'm working with a numerical algorithm whose output $$y$$ asymptotically approaches a certain unknown value $$a$$.

I expect an exponential convergence, i.e. the data $$y$$ given by my algorithm should be distributed as

$$y=a+b e^{-c x}$$

where $$x$$ represents the number of iterations of the algorithm. For computational purposes, it's good to terminate the algorithm when $$x$$ is still relatively small, say when $$x=x^*$$. In this case, however $$y(x^*)$$ hasn't fully reached its asymptotic value $$a$$.

I kindly ask you to provide a Matlab code which takes some tens of pairs $$(x,y)$$ and, retrieves the value $$a$$ appearing in the aforementioned equation.

• This is not the right place to ask for code. You can ask for explanations, though. – nicoguaro Jun 2 at 17:54
• You can do a non-linear fit of your data. – nicoguaro Jun 2 at 18:36
• You may use gnuplot or matplotlib to easily fit the function you gave to the data. Your fit result should include an estimate of the asymptote and also some error bounds. Just google for a fitting tutorial of your choice. – MPIchael Jun 5 at 12:31