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?
 A: You are trying to solve the harmonic inversion problem. That website contains code and programs for it.
A: The figure 1 below shows the result of an attempt to fit the experimental curve with the expected equation. 
The scanning of the graph yielded a data of about 360 points. Taking only the first 60 points, the fitting is rather good (thick black curve). But soon the computed curve becomes more and more far from the other experimental points (thin red curve).
This draw to think that the phenonena is more complicated and cannot be correctly model with the expected function. Some additional and relatively important terms probably appear. The constant term (noted $\lambda_0$ on the figure) seems of relatively low importance at the beginning, but more visible later.

The method used for the fitting is described  page 49 and top of page 50 in the document :  http://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales
On this paper, the constant term (noted here $\lambda_0$ ) doesn’t exists (4 parameters regression). A small modification allows to introduce this additional parameter. So, in fact,  the computation was done with the 5 parameters. 
With the expected function, it works properly only for the begining of the experiment. If all the points are taken into account, the fitting fails completely, which tends to confirme that the expected function is not convenient to model all the experiment.
A: Your data obviously doesn't fit your trial equation.  It appears to be two oscillations beating with dissipation.  Could be two coupled oscillators?  Try fitting to the solution of the coupled diff. equations.  A.P. French's "Vibrations and Waves" does this at the beginner's level well.  I've done it both numerically and experimentally using a spring loaded cart as the support of a pendulum.  This prob. is solved by AP French [MIT internet course --not the text] linearized, and exactly by Cooper and Pellegrini in "Modern Analytic Mechanics".  
bc
A: If the data
is really a damped oscillation,
then the peaks should be
a constant distance apart.
So, an initial check would be
to compute the location of the peaks
and see if
(1) the distance between them is
approximately constant;
(2) the values at the peaks alternate in sign;
and
(3) the magnitudes at the peaks
decrease in approximately
geometric progression.
If these do not hold,
your data does not fit
a damped oscillation.
If they do hold,
the distance between the peaks
and the information
about the magnitudes
of the peaks
should allow you to
do the fit.
