Given two points $P_1(x_1,y_1)$ and $P_2(x_2,y_2)$ with $y_1>0$ and $y_2>0$ I need to find the parameters $a$ and $b$ of an exponential function having the form $y=a*b^x$.
How I can solve this problem in a "generic" way getting the formulas to find $a$ and $b$ from known $P_1$ and $P_2$? I tried to find the solution by myself for two hours but I keep getting the same, wrong formulas.
If $y_1=ab^{x_1}$ and $y_2=ab^{x_2}$, then$$\frac{y_2}{y_1}=\frac{ab^{x_2}}{ab^{x_1}}=b^{x_2-x_1}.$$So, take $b=\left(\dfrac{y_2}{y_1}\right)^{1/(x_2-x_1)}$. And now $a=\dfrac{y_1}{b^{x_1}}$.