Another approach is to use the translation or time-shift theorem in Fourier analysis:
$$h(x) = f(x-x_0) \Leftrightarrow \mathcal{F}\{h\}(\omega) = e^{i2\pi x_0 \omega} \mathcal{F}\{f\}(\omega)$$
We see that the phase increase is a linear function of $\omega$.
- Do a one way FFT for each signal,
- Calculate the phases.
- Calculate the derivative w.r.t. $\omega$ of the difference of the phases.
- Calculate a certainty measure from the absolute values.
- Calculate weighted mean of step 3 using certainty measure above.
The certainty measure is to avoid noise or numerical error to influence the solution. Parts of the Fourier domain which have low absolute value are much more noise sensitive, therefore the need to have a certainty measure.
Here is a sample 3rd order polynomial being displaced, noised and then corrected:
Here is phase estimate in blue and certainty measure in red. Y axis is estimated displacement for blue and x is frequency with DC being in the middle.
