0
$\begingroup$

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.

$\endgroup$
  • 3
    $\begingroup$ This is not the right place to ask for code. You can ask for explanations, though. $\endgroup$ – nicoguaro Jun 2 at 17:54
  • 3
    $\begingroup$ You can do a non-linear fit of your data. $\endgroup$ – nicoguaro Jun 2 at 18:36
  • 1
    $\begingroup$ 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. $\endgroup$ – MPIchael Jun 5 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.