Fitting exponential curve to data

If I have a collection of data points that follow an exponential curve relationship, how can I manually construct the equation that defines the best-fit exponential curve for the data?


I assume you are looking for a curve of the form $y=Ae^{kx}$.

For all your data points $(x_i,y_i)$, compute $w_i=\ln(y_i)$.

Find in the usual way constants $a,b$ such that the line $w=a+bx$ is a line of best fit to the data $(x_i,w_i)$.

Then $e^a$ and $b$ are good estimates for $A$ and $k$ respectively.

Added: "Line of best fit" is a huge subject. We describe a basic method, least squares. The idea is to find numbers $a$ and $b$ which minimize $$\sum_{i=1}^n \left(w_i -(a+bx_i)\right)^2.$$ It turns out that the best $b$ and $a$ are given by the following formulas: $$b=\frac{\sum_{i=1}^n x_iw_i -\frac{1}{n}\left(\sum_{i=1}^n x_i\right)\left(\sum_{i=1}^n w_i\right)}{\sum_{i=1}^n x_i^2 -\frac{1}{n}\left(\sum_{i=1}^n x_i\right)^2}$$ and $$a =\frac{1}{n}\sum_{i=1}^n w_i -\frac{1}{n}b\sum_{i=1}^n x_i,$$ where $b$ is given by the previous formula.

I suggest you look for "least squares" elsewwhere for a more detailed discussion.


If the function to be fitted is y=A*exp(k*x), then a classical linear regression applied to ln(y)=c+k*x directly leads to the goal. If the function is y=A*exp(k*x)+C, this is more difficult. The usual methods of non linear regression requires a guess of the parameters and iterative computation. A different and non classical method doesn't requires guess nor interation. This traightforward method is shown, with a numerical example, pages 17-18 , in the paper : http://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales


Assuming your functions are of the form $A e^{bx}$, the first step is to take the log of the data and then compute the line of best fit. The slope of the resulting line will give you a good approximation for $b$. The constant term will give you a good approximation to $\log A$. This may not be the exponential of best fit in the true sense because larger errors for large $x$ will be scaled down when taking the log, depends on your needs.