3
$\begingroup$

I'm trying to find the period of a signal. I've used FFT to compute the autocorrelation of the signal. As can be seen from the autocorrelation function (plotted below) I obtained, there are 70 sample between peaks which actually indicates the period of my signal.

What is the best way to extract the indices of these peaks from such a data?

autocorrelation

$\endgroup$
2
$\begingroup$

Removing the DC offset from your signal will get rid of the triangular "trend" seen here. Another way to detrend data (which is not specific to autocorrelation functions) is to subtract from your function a median-filtered version of itself (the median-filtered version corresponding to the trend).

You can then detect peak by detecting local maxima - if $X(n) = \max_{k \in [k-W, k+W]} X(k)$, then $n$ is a peak. $W$ is a scale factor which indicates how narrow and close to each other you allow your peaks to be.

$\endgroup$
  • 4
    $\begingroup$ I don't believe the triangular shape is due to use of the unbiased vs biased estimator. Even if the unbiased estimator were to be used, you'd still get a "constant" offset. That's because the data seems to have a DC offset. Remove that before any further processing. $\endgroup$ – Peter K. Sep 10 '12 at 23:30
  • $\begingroup$ You are correct indeed, it looks like the input signal has a DC offset; and I have edited my answer accordingly. $\endgroup$ – pichenettes Sep 11 '12 at 1:35
  • 2
    $\begingroup$ Debiasing is still useful when it is required to assess the relative strength of peaks. $\endgroup$ – pichenettes Sep 11 '12 at 1:44
  • $\begingroup$ Certainly, the unbiased estimator should be used, I just think that's a second order effect compared with removing the DC component. $\endgroup$ – Peter K. Sep 11 '12 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.