5
$\begingroup$

I have a noisy data set (the grey line in the graph below) that corresponds roughly to $y=m(1-2^{-x/k})$ where m and k are unknown constants.

How can I determine the best-fit value of m and k?

enter image description here

I can get an approximate value for k by guessing m and then doing linear regression on $-\log_2(1-y/m)$... by this I estimate m=0.96 and k=1000 (see red and blue dotted lines above), but is there a more systematic way?

Thanks in advance.

3 Answers 3

5

Why not do nonlinear least-squares via Levenberg-Marquardt instead of futzing with linearizations? There is the lsqnonlin() function available in MATLAB via the Optimization Toolbox. You will need to figure out good starting values for $m$ and $k$, though that LM can polish to a (hopefully) adequate answer.

  • 0
    Thanks for this, I hadn't come across `lsqnonlin()` before... I'll see if I can make it work.2011-09-03
1

I made this tutorial article about linear and nonlinear least-squares methods.

0

Another method is to perform a Laplace transform on the data to transform the function to a rational function. In general one can then apply a polynomial fit and then use the method of Padé approximants to write that as a rational function of the desired form, but in this case we don't need to do that as we'll see below.

Since Laplace transforms involve an integral from zero to infinity, we need to impose a cut-off. In this case this requires multiplying the data by an exponential $\exp(-\lambda x)$ where you choose $\lambda$ such that at $x = 8000$ the function is close to zero while you still have a fair range for $x$ where the function is not small. E.g. taking $\lambda = \frac{1}{1500}$ should yield a good result. A cut-off at $x = 8000$ can then be imposed with negligible error.

So, we want to make a fit using a function of the form:

$f(x) = m\left[\exp(-\lambda_1 x) - \exp(-\lambda_2 x)\right]$

The Laplace transform of this is:

$\hat{f}(s) = m\frac{\lambda_2 - \lambda_1}{(s+\lambda_1)(s+\lambda_2)}$

This means that making a quadratic fit to $\frac{1}{\hat{f}(s)}$ will yield the parameters $m$, $\lambda_1$ and $\lambda_2$.