FFT-based methods

We begin with two classical formulae. The correlogram is defined as

 hat{f}_c =sum_{k=-(N-1)}^{N-1} hat{r}(k) e^{-itheta k},

where hat{r}(k) denotes an estimate of the covariance lag r(k), whereas the periodogram

 hat{f}_p(theta) = frac{1}{N} |sum_{t=0}^{N-1} y(t) e^{-itheta t}|^2.

The two coincide when the correlation lag hat{r}(k) is estimated via

 hat{r}_k=frac{1}{N} sum_{t=-N+1}^{N-1}y(t)y_b(k-t):= frac{1}{N} (y*y_{b})(k),; k=-(N-1), ldots, 0, ldots, N-1,

where y_b(t):=y^*(-t). The periodogram can be efficiently computed using the fast Fourier transform (FFT). There is a variety of methods, such as Welch and Blackman-Tukey methods, designed to improve the performance using lag window functions either in the time domain or in the correlation domain. In situations when the data length is short, to get a smooth spectrum, we may increase the data length by padding zeros to the sequence.

Using the above example, we pad up 2048 by adding zeros. The corresponding FFT-based spectrum is shown in the following figures. Rudimentary code is displayed as a demonstration. A file to reproduce the following results can be downloaded. Alternative matlab build-in routines for periodograms are periodogram, pwelch, etc.

% the fft-based spectra
NN=2048; th=linspace(0,2*pi,NN);
Y =abs(fft(y,NN))/sqrt(N);
Y = Y.^2;