Take the 2-minute tour ×
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.

I have a set of datapoints, in this case the temperature of an object adjusting to the environment temperature over time. Because I know these kind of processes take the form of $$f(x)=Ae^{x/B}+C$$ I think it should be very well possible to predict the near future for this process if I can find these $A$, $B$ and $C$ in the equation. And this is exactly my question.
I know the method of applying linear regression to the log of the data and it works perfectly well, but only to find $A$ and $B$ if the constant $C$ is zero and this is not true in my case. In fact, it's one of the most important things I want to find from the data as it would indicate the environment temperature.
Something tells me that this should be pretty straightforward to do but I just can't get to it.

share|improve this question
I have seen these, but I won't be able to use matlab so the answers there don't help me. Also I think there should be a solution much simpeler than Levenberg-Marquardt. –  Daniel Reus Feb 8 '12 at 15:27
add comment

3 Answers 3

up vote 1 down vote accepted

This is a non-linear system of equations, so, in general, it is a mess (analytically).

However, as I discovered many years ago, in the case where you have three equally spaced $x$ values, you can solve it directly.

Suppose $y_i = a e^{b x_i} + c$ for $i = 1, 2, 3$ and $x_2-x_1 = x_3-x_2 = d$.

Then $y_2-y_1 = a(e^{b x_2}- e^{b x_1}) = a e^{b x_1}(e^{b(x_2-x_1)}-1) = a e^{b x_1}(e^{bd}-1) $.

Similarly, $y_3-y_2 = a e^{b x_2}(e^{bd}-1) $.

Therefore $\frac{y_3-y_2}{y_2-y_1} = e^{b(x_2-x_1)} = e^{bd} $.

This determines $b$. Either of the equations for $y_{i+1}-y_i$ then determines $a$, and any of the original equations determines $c$.

share|improve this answer
Thanks, this is what I was looking for! –  Daniel Reus Jan 25 '13 at 12:33
add comment

Okay, I solved my problem for now like so:

  • For the whole range in which I expect C do:
    • Assume a value for C
    • Take the log of the datapoints - C
    • Do linear regression over the obtained numbers and by that obtain the best A and B for the given C
    • Calculate E, the sum of absolute differences between the points in the dataset and the points that would follow using the obtained A, B and C
  • Choose A, B and C for which E was smallest.

To optimize things a bit I first do the process with large steps for C and than repeat it around the minimum with finer steps.

I think there should be better ways but this works well enough for my situation.

share|improve this answer
Any numerical analysis text will discuss multidimensional minimization and provide routines. Basically you minimize the sum of squares of the errors from your model function to the data. Excel provides Goal Seek which can be used for this purpose as well. –  Ross Millikan Jul 30 '12 at 23:27
add comment

Do the experiment in the freezer with a control temp, then find A and B.

These should be true for any C

share|improve this answer
What experiment? –  Cameron Buie Nov 2 '12 at 20:19
add comment

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.