# How to approximate $f(x)=a\cdot e^{x}+b$?

There is common way in which one can approximate $$f(x) = a\cdot e^{bx}$$ . Just use $$ln$$ for both formula's sides and make it linear. What about $$f(x) = a\cdot e^{bx}+c$$ ? How to determine $$a$$, $$b$$ and $$c$$ having set of $$(x,y)$$ pairs?

• \cdot for multiply – user645636 Dec 31 '19 at 4:21
• And \exp for the exponential function – Ross Millikan Dec 31 '19 at 4:29
• The $c$ does not "matter" for large values of $x$. The line $\ln(a)+bx$ quickly approaches $\ln(a\cdot\exp(bx)+c)$ for any value of $c$. And by quickly, I mean: desmos.com/calculator/xiw3rmm21k – David Peterson Dec 31 '19 at 4:39

Adding in the parameter $$c$$ means you cannot use linear least squares any more because the function cannot be linearized. You need a multidimensional minimizer. They are discussed in any numerical analysis text. If your data go out far enough the exponential will become close to $$0$$ and you can just take $$c$$ to be the average of the last few data points, then use the linearized form on $$f(x)-c$$
The model $$y=a e^{bx}+c$$ is nonlinear because of $$b$$. Now, suppose you fix $$b$$ at a given arbitrary value and definine $$t_i=e^{b x_i}$$ you face the linear model $$y=at+c$$ which is easy to solve.
When done, compute the sum of squares of residuals $$SSQ(b)$$ and repeat the process for a few values of $$b$$ until you see more or less a minimum. At this point, you know the corresponding values of $$a$$ and $$c$$ and you can start the nonlinear regression. If you do not have such a tool, continue with the plot zooming more end more around the minimum.
Another solution for obtaining "reasonable" guesses (assuming not too much moise in the data) is to pick (even "by eye" from a scatter plot) three data points $$(x_1,y_1)$$, $$(x_2,y_2)$$, $$(x_3,y_3)$$. So, you have $$y_1=a e^{bx_1}+c \tag 1$$ $$y_2=a e^{bx_2}+c \tag 2$$ $$y_3=a e^{bx_3}+c \tag 3$$ from which $$y_2-y_1=a(e^{bx_2}-e^{bx_1})\tag 4$$ $$y_3-y_2=a(e^{bx_3}-e^{bx_2})\tag 5$$ $$\frac{y_3-y_2 } {y_2-y_1 }=\frac{e^{bx_3}-e^{bx_2}}{e^{bx_2}-e^{bx_1}}\tag 6$$
But, you selected the points such that $$x_2=x_1+d$$ and $$x_3=x_1+2d$$. This makes $$\frac{y_3-y_2 } {y_2-y_1 }=e^{bd} \implies b=\frac 1 d \log\left(\frac{y_3-y_2 } {y_2-y_1 } \right)\tag 7$$ Go back to $$(4)$$ or $$(5)$$ to get $$a$$ and then to $$(1)$$, $$(2)$$ or $$(3)$$ to get $$c$$.