Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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...

share|cite|improve this question
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
up vote 3 down vote accepted

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:

  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:

enter image description here

share|cite|improve this answer

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 :

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.

enter image description here

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.