Calculate autocorrelation using FFT in Matlab

前端 未结 2 1897
挽巷
挽巷 2020-11-30 21:22

I\'ve read some explanations of how autocorrelation can be more efficiently calculated using the fft of a signal, multiplying the real part by the complex conjugate (Fourier

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 22:15

    By the Wiener–Khinchin theorem, the power-spectral density (PSD) of a function is the Fourier transform of the autocorrelation. For deterministic signals, the PSD is simply the magnitude-squared of the Fourier transform. See also the convolution theorem.

    When it comes to discrete Fourier transforms (i.e. using FFTs), you actually get the cyclic autocorrelation. In order to get proper (linear) autocorrelation, you must zero-pad the original data to twice its original length before taking the Fourier transform. So something like:

    x = [ ... ];
    x_pad = [x zeros(size(x))];
    X     = fft(x_pad);
    X_psd = abs(X).^2;
    r_xx = ifft(X_psd);
    

提交回复
热议问题