Skip to content
jasonli17 edited this page Oct 8, 2013 · 2 revisions

The Power Spectral Density (or Power Density Spectrum) is calculated from the Fourier Transform of a random processes autocorrelation. “The power density function of a real signal is real, even, and nonnegative[O&S pg 68].” A random process does not have a spectrum, because it is indeterminate and varies with time. Instead, a PSD is used to provide information on the statistical properties of the random signal being evaluated.

A periodogram is often used to estimate the PSD of a random process. A periodogram is the PSD estimate of a rectangularly windowed segment of data. Specifically, it is the Fourier Transform of the aperiodic correlation function of data that has had a rectangular window applied to it. If a window type other than the rectangular window is used then it is referred to as a modified periodogram [O&S pg 838]. By taking successive periodograms and averaging them together, it is possible to get an estimate of the PSD over the given length of time that the periodograms covered. Welch showed that this estimate can be improved (i.e. the variance of the result lowered) by overlapping success periodograms. The best an estimate could be made was to overlap windows by a factor of two. Further overlapping windows did improve results (i.e. lower the variance) because successive window segments became less and less independent of each other [O&S 844].

Averaging our periodograms helps provide a more accurate estimate of the PSD.

Matlab provides a function to provides two functions which can be used to calculate the PSD in this fashion, they are periodogram and pwelch. The equivalent results from these two functions for the real EEG signal data being used here can be accomplished with the following steps:

  1. Apply a window spaced at the desired overlap
  2. Calculate the FFT of each window (zero pad as desired)
  3. Square the magnitude of the result and correct for the energy that was lost from windowing
  4. For a single sided PSD, multiply non-unique sample points by 2 in order to conserve energy
  5. Divide the result by the sampling frequency (why not the nyquist frequency?)
  6. Average the resulting periodograms or modified periodograms with each other to get the PSD estimate for the desired length of time.

Windowing the data with something other than a rectangle window can improve the effects of leakage when calculating the PSD.

Removing the mean helps prevent leakage into adjacent frequencies [O&S pg 838]. This is helpful in the lower frequencies but does not have as much of an impact above a few Hz for our case. Since we are primarily interested in examining the power in bands of frequencies these steps are not so significant.

When saving the PSD to file, each windowed segment is flagged as either overlapping or nonoverlapping with artifactual data. If any section of the PSD window has artifact within it then it is marked as an artifactual periodogram. The current sleep stage of each periodogram is also saved to the file. This is useful for further analysis of the effects of artifacts on the PSD and the behavior of the PSD in different sleep stages.

hann window

An option is also provided to save the FFT values to file in case different methods of calculating the PSD in the future are desired. Only the magnitude of the FFT is saved to file. A dialog interface was created (Figure 3) to allow the user to select the various parameters used in calculating the FFT and PSD. Different window types can be selected along with the window length in seconds as well as the interval. Combining the window length with the interval can produce different degrees of overlap. For example, changing the interval in Figure 3 to one-second would result in a 50% overlap (currently there is no overlap).