An improved solution for curve fitting data to an exponential equation (y = AeBt + C) has been developed. This improvement is in four areas — speed, stability, determinant processing time, and the removal of limits. The solution presented avoids iterative techniques and their stability errors by using three mathematical ideas: discrete calculus, a special relationship (between exponential curves and the Mean Value Theorem for Derivatives), and a simple linear curve fit algorithm. This method can also be applied to fitting data to the general power law equation y=AxB +C and the general geometric growth equation y=AkBt +C.

This improved method offers several advantages over prior exponential-curve-fitting methods. The advantages are as follows:

  • Speed: Iterative (non-linear) methods are 50 to 100 times slower. Previously, only iterative methods could be used when C was not zero, or when all the samples were not zero or greater.
  • Stability: No bad guesses. There is no chance of making a bad first guess as sometimes happens in iterative (non-linear) techniques. Sometimes the iterative techniques “blow up” when they start with a bad guess.
  • Real-Time requires determinism: Being faster would allow this method to be used in real-time applications where non-linear methods take too much processing time. But, most real-time applications require determinism (a consistent processing time from curve fit to curve fit, or at least a known maximum processing time). Iterative techniques vary greatly in the processing time they consume. This new method takes the same amount of processing time (for the same number of data points), no matter what the error distribution is. Iterative techniques sometimes only take 50 times longer and sometimes more than 100 times longer, depending on how the data varies and the initial guesses.
  • y can cross zero: Even if C = 0, the non-iterative methods require all sample points to be zero or greater (or transformed to greater than zero). This method does not have any such limitation.

The improved method has a theoretical basis in discrete calculus, statistics, and regular calculus. The following description of the method omits most of the details of the theory for the sake of brevity.

Two Regions of Points that overlap are shown. The slope ratios of these two regions are used in estimating B. In this example, A =7, B = -2 and C = 100.
The method is embodied in an algorithm for computing B in the equation y = AeBt + C. Once B is known, typical linear methods can be used to solve for A and C. This method presents many ways to compute B. One way is by doing a linear (straight line) curve fit to two different regions in the data. The change in slope of these two regions gives us an estimate for B. The two different regions can even overlap each other to improve the curve fit. B is only dependent on the change in slope and the change in time.

Let SR1 be the slope calculated for Region 1 (see figure). Let SR2 be the slope calculated for Region 2. Then the change in slope can be estimated by SR1/SR2. The time used to cause this change in slope is equal to the time between the first samples in each region (if each region contains the same number of equally spaced points). It can be shown that:

B = ln(SR1/SR2)/(t1 t2).

This work was done by Geoffrey Rowe of ASRC Aerospace Corp. for Kennedy Space Center. For more information, download the Technical Support Package (free white paper) at under the Software category. KSC-13153

Software Tech Briefs Magazine

This article first appeared in the September, 2010 issue of Software Tech Briefs Magazine.

Read more articles from this issue here.

Read more articles from the archives here.