Spectrum windows and multi-record spectra

Although the DFT itself produces unique values for the spectra of discrete input signals, the result of a particular spectral analysis does depend on the kind of input weighting function (if any) which is applied to the signal before the DFT is performed. Usually, a signal is premultiplied by a specific "data windowing" function before a DFT is performed, so that the resulting spectrum will have sharper peaks and less inter-frequency contamination. For a more detailed discussion of data windowing, please see the windowing page, or any textbook on signal processing.

The DFT component used in the component software provides for data windowing by several different standard functions. Here is a component software example which shows the calculation of spectra windowed by different functions for the EEG dataset shown at the end of the previous page:

The configuration dialog of the DFT component allows one to select the data windowing function which is applied to the input signal before the transform is computed. This dialog also allows for a considerable flexibility in the parameters used to compute the transform, much more so than is provided by an FFT computation which is found in most other signal processing packages.

The window functions available in this component are the following, for i = 0 to N-1:

• Bartlett: y(i) = 1 - abs((i - N/2) / (N/2))

• Blackman: y(i) = 0.42 - 0.5 cos(2 Pi i / N) + 0.08 cos(4 Pi i / N)

• Gaussian: y(i) = exp(-((i - N/2)^2) / (N^2 / 15))

• Hamming: y(i) = 0.54 - 0.46 cos(2 Pi i / N)

• Hanning: y(i) = 0.5 * (1 - cos(2 Pi i / N))

• Rectangular: y(i) = 1

• Welch: y(i) = 1 - ((i - N/2) / (N/2))^2

Note that the rectangular window is the same as using no window at all.

Here are the shapes of the various window functions:

(Click for larger image)

Here are the average spectra computed for the 30 seconds of EEG data shown at the end of the last page, for each of the 7 different data windowing functions, from 0-32 Hz. Each curve is the average of 30 different spectrum magnitudes for 1 second of EEG data acquired at 256 samples/sec:

(Click for larger image)

Note that the Blackman, Gaussian, Hamming, and Hanning windows all have similar shapes, and produce average spectra of similar shape. Note also that the average spectrum for the rectangular window is the most "jagged", due to the large multiple sidelobes in the spectrum of this window function. In general, I and most textbooks recommend any of the "bell shaped" window functions, as they seem to work best in most situations. The Gaussian and Hamming windows seem to provide the best compromise between spectra which have too many "wiggles", and those which are too smooth.

Here are the multiple spectrum records which have been averaged together to produce the curves shown above. Each curve in the cascade plots below is the 0-32 Hz spectrum magnitude for one second of EEG data. In this case, the most recently acquired data is at the back of the plots.

(Click for larger image)

Here is a detail from the Blackman window spectrum, shown as a filled surface:

Each individual spectrum in the above plots was computed from only 256 points of sequential EEG data. One can increase the resolution of the resulting spectra by transforming a signal which contains more points (in this case, has a longer duration at the same sampling rate). In order to compute longer transforms, multiple signal records are combined into a single longer record containing more points. In order to produce as many such combined records as possible, and to reduce the variance in the spectrum averages, the individual records which comprise each combined record can be overlapped in time. For example, to combine records in groups of threes with overlap, the first multiple record contains records 1, 2, and 3; the second record contains records 2, 3, and 4; and so on... In this way, an input signal consisting of N records is transformed into a set of N - M + 1 records, where M is the combining factor.

Here is a diagram showing the combination of 7 records of 256 points each into 5 records of 768 points each by threes:

Here is an example of using the component software to combine the 30 seconds of EEG data shown at the end of the last page into new sets of multiple overlapped records. The FIFO component used to accumulate data has the ability to reformat its contents in the manner described above. This property has been used below to create four new sets of data by combining the original 30 records by 2, 3, 4, and 5 records each, resulting in datasets containing 29 records of 512 points each, 28 records of 768 points, 27 records of 1024 points, and 26 records of 1280 points:

New average spectra were then computed for each of the combined record sets, using a Gaussian data window in the DFT:

(Click for larger image)

Here is a detail of the 10 Hz alpha peak from the average spectrum of 26 records of 1280 points each:

Note that the longer transform used has resolved the single peak into one main peak and several other minor peaks near 10 Hz, indicating that the alpha band contains several different individual frequency components. In order of magnitude, the first 4 of these peaks come at 10.29 Hz, 11.04 Hz, 11.92 Hz, and 9.66 Hz. The resolution of this plot is 0.125 Hz/point.

Here is a cascade plot of the entire set of spectra computed for this combined set of 1280 point records, for 0-32 Hz: