[Math] fitting by linear combination of exponential functions

exponential functionleast squaresnumerical methods

Suppose that we have a set of points $(x_1,y_1), \ldots (x_n,y_n)$, and we want to fit a function of the form $f(x) = ae^{2x} + be^x + c$ to those points. If we make $z=e^x$, then our function becomes a second-degree polynomial in $z$: $f(z) = az^2+bz+c$. My question is: Which transformations (if any) do I have to make on the points $(x_i,y_i)$ in order to be able to fit the second-degree polynomial $f(z)$ to the set of transformed points, by the usual method of least squares?

Best Answer

Least squares folution to overdetermined system $Ax = b$ is given by $$ x = \left(A^\mathsf{T} A\right)^{-1} A^\mathsf{T} b $$ There's no need to do a transform $z = e^x$, it is solvable as it is. Rewrite the overdetermined system $$ e^{2x_1} a + e^{x_1} b + c = f_1\\ e^{2x_2} a + e^{x_2} b + c = f_2\\ \vdots\\ e^{2x_n} a + e^{x_n} b + c = f_n\\ $$ in matrix form $$ A = \begin{pmatrix} e^{2x_1} & e^{x_1} & 1\\ e^{2x_2} & e^{x_2} & 1\\ &\vdots\\ e^{2x_n} & e^{x_n} & 1\\ \end{pmatrix}, \qquad f = \begin{pmatrix} f_1\\f_2\\\vdots\\f_n \end{pmatrix}. $$ Now, $$ A^\mathsf{T} A = \begin{pmatrix} \sum_i e^{4x_i}& \sum_i e^{3x_i} & \sum_i e^{2x_i}\\ \sum_i e^{3x_i}& \sum_i e^{2x_i} & \sum_i e^{x_i}\\ \sum_i e^{2x_i}& \sum_i e^{x_i} &1 \end{pmatrix}\\ A^\mathsf{T} b = \begin{pmatrix} \sum_i e^{2x_i} f_i\\ \sum_i e^{x_i} f_i\\ \sum_i f_i \end{pmatrix} $$

Related Question