How does one fit the curve $y = ae^{bx} + c$?

How does one fit the curve $y = ae^{bx} + c$?

The method of taking logarithms of both sides does not simplify to allow linear regression.

I can take the three equations derived from setting the gradient to zero and solve for $a$ and $c$ in terms of $b$, but then I'm left with a non-linear equation in $b$ which I would have to solve numerically.

Is there a better way? It seems like this is a trivial modification to the case where $c$ is zero...

-
I would say that's actually the best way to do your equation, since you have exploited the fact that your parameters $a$ and $c$ are linear parameters in your model. (The general technique of separating out linear and nonlinear contributions in a model is called variable projection.) Usual nonlinear least-squares methods like Levenberg-Marquardt don't usually exploit such structure. Look at it this way: instead of having to solve for three nonlinear parameters (which is a more difficult problem), you are left with the much easier task of solving for only one unknown. – J. M. May 30 '12 at 14:04

Given the overall structure of your question, I'll assume that you have given data and by "fit the curve", you mean to find values of $a$, $b$, and $c$ so that the function $ae^{bt}+c$ is a good fit to that data.

In general, given data $\{x_i,y_i\}_{i=1}^n$ and a function univariate function $f_{a,b,c}(x)$ that depends on parameters $a$, $b$, and $c$, we fit the data by finding values of $a$, $b$, and $c$ that minimize $$\sum_{i=1}^n (f_{a,b,c}(x_i) - y_i)^2.$$ In the case where the expression $f_{a,b,c}(x)$ is linear in the parameters $a$, $b$, and $c$, this is a linear optimization problem and nice matrix methods can be applied. Otherwise, it's a non-linear optimization problem. Sometimes, this non-linear problem can be translated to a linear problem but sometimes strictly non-linear techniques must be used.

As an example, you might try the following input in WolframAlpha:

FindFit[{{-3,-1},{-2,0},{-1,0},{0,1},{1,2},{2,4},{3,8}},
a*exp(b*t)+c, {a,b,c}, t]


You should find that $f(t)=1.74*e^{0.54t}-0.96$ is a reasonable fit to this data. The result is given as a numerical approximation (decimal numbers, rather than exact), because numerical techniques are used. A plot of the function and the data looks like so:

-

A straightforward method (no need for initial guessed values, no iterative process) is shown with numerical example in pages 16-18 in the paper "Régressions et équations intégrales" published on Scribd :

http://www.scribd.com/JJacquelin/documents

With the data set given by Mark McClure, the result is shown on the figure below. The fitting of the curve to the data is quite the same, although the values of the parameters are slightly different. For practical use, the difference is negigible. This small discripency is a consequence of the too low number of experimental points.

-