# Efficient method for refining parameters in nonlinear curve fitting

I have time-series electrical current data $i(t)$ with transient steps in it which are convoluted with the hardware filter used in data acquisition. As a result, the real steps in current, which would in reality be represented by the form

$i(t)=i_0+i_1H(t-\tau_1)+i_2H(t-\tau_2)$

is measured as something of the form

$i(t)=i_0+i_1\left(1-\exp(-\frac{t-\tau_1}{\sigma_1})\right)H(t-\tau_1)+i_2\left(1-\exp(-\frac{t-\tau_2}{\sigma_2})\right)H(t-\tau_2)$

where $H(t)$ is the Heaviside step function. I know that $i_1\approx -i_2$ in the vast majority of cases. I am interested in recovering the original step function, that is, in obtaining accurate values of $i_0, i_1, i_2, \tau_1, \tau_2$.

I can do this curve fitting in Origin current, which works fine, but I am interested in coding this into some custom analysis software I have written in C. Following some advice I received over here: http://www.artofproblemsolving.com/Forum/viewtopic.php?f=296&t=621331, I have been able to narrow down the problem to a more specific question, which follows shortly. My current method is as follows:

1) I use a thresholding algorithm to obtain approximate values for $\tau_1$ and $\tau_2$

2) Estimate $i_0$ by averaging $i(t)$ over $[0,\tau_1)$

3) Subtract $i_0$ and fit $i_1\left(1-\exp(-\frac{t-\tau_1}{\sigma_1})\right)$ to $[\tau_1,\tau_2)$ with simple least-squares.

4) Subtract the first two terms and fit $i_2\left(1-\exp(-\frac{t-\tau_2}{\sigma_2})\right)$ to the remaining interval.

5) $\sigma_1$ and $\sigma_2$ can be hard-coded, since they are (mostly) just determined by the details of the hardware filter in question.

This gives very good estimates of all the parameters and is computationally very cheap. What I need now is a way to find the global minimum, which should be not too far from my approximate solution. I am hoping that someone can suggest a reasonably cheap algorithm to refine my initial guess to something better.

I have included an image below of a sample event and the fitting done in Origin. 