Damped oscillation fit We have some measurement data like this:  
 
The expected behavior of the data is a damped oscillation:
$$y=a e^{d*t} cos(\omega t+\phi) + k$$
Where:
$t$ Current time
$y$ Current deflection  
$a$ Amplitude
$d$ Damping factor
$\omega$ Angluar velocity
$\phi$ Phase shift
$k$ Offset
The task is to fit the 5 parameters to match the real data.
Our current approch does the following:
- Find start values for all 5 parameters
- Place the values into a system of equations
- Iterate until the error gets below a given value
In most cases this works well. But in some cases it fails (breaking after 100 iterations). Now there are two possible options:
1) Suppose that the data is 'too bad' and give up
2) Find a better solution
Does anyone have a idea of different ways to solve this?

You are trying to solve the harmonic inversion problem. That website contains code and programs for it.
