TOPICS
Search

Least Squares Fitting--Exponential


LeastSquaresExp

To fit a functional form

 y=Ae^(Bx),
(1)

take the logarithm of both sides

 lny=lnA+Bx.
(2)

The best-fit values are then

a=(sum_(i=1)^(n)lny_isum_(i=1)^(n)x_i^2-sum_(i=1)^(n)x_isum_(i=1)^(n)x_ilny_i)/(nsum_(i=1)^(n)x_i^2-(sum_(i=1)^(n)x_i)^2)
(3)
b=(nsum_(i=1)^(n)x_ilny_i-sum_(i=1)^(n)x_isum_(i=1)^(n)lny_i)/(nsum_(i=1)^(n)x_i^2-(sum_(i=1)^(n)x_i)^2),
(4)

where B=b and A=exp(a).

This fit gives greater weights to small y values so, in order to weight the points equally, it is often better to minimize the function

 sum_(i=1)^ny_i(lny_i-a-bx_i)^2.
(5)

Applying least squares fitting gives

 asum_(i=1)^ny_i+bsum_(i=1)^nx_iy_i=sum_(i=1)^ny_ilny_i
(6)
 asum_(i=1)^nx_iy_i+bsum_(i=1)^nx_i^2y_i=sum_(i=1)^nx_iy_ilny_i
(7)
 [sum_(i=1)^(n)y_i sum_(i=1)^(n)x_iy_i; sum_(i=1)^(n)x_iy_i sum_(i=1)^(n)x_i^2y_i][a; b]=[sum_(i=1)^(n)y_ilny_i; sum_(i=1)^(n)x_iy_ilny_i].
(8)

Solving for a and b,

a=(sum_(i=1)^n(x_i^2y_i)sum_(i=1)^n(y_ilny_i)-sum_(i=1)^n(x_iy_i)sum_(i=1)^n(x_iy_ilny_i))/(sum_(i=1)^ny_isum_(i=1)^n(x_i^2y_i)-(sum_(i=1)^nx_iy_i)^2)
(9)
b=(sum_(i=1)^ny_isum_(i=1)^n(x_iy_ilny_i)-sum_(i=1)^n(x_iy_i)sum_(i=1)^n(y_ilny_i))/(sum_(i=1)^ny_isum_(i=1)^n(x_i^2y_i)-(sum_(i=1)^nx_iy_i)^2).
(10)

In the plot above, the short-dashed curve is the fit computed from (◇) and (◇) and the long-dashed curve is the fit computed from (9) and (10).


See also

Least Squares Fitting, Least Squares Fitting--Logarithmic, Least Squares Fitting--Power Law

Explore with Wolfram|Alpha

Cite this as:

Weisstein, Eric W. "Least Squares Fitting--Exponential." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/LeastSquaresFittingExponential.html

Subject classifications