Overview of spectral analysis

Spectral analysis is concerned with determining the frequency content of an arbitrary signal using digital computers. Obtaining a suitable discrete-frequency representation of a discrete-time signal requires two steps:

In the first step, a finite segment of the discrete-time signal is extracted using a discrete-time window. This window simply selects part of the signal; depending on the window shape, it may scale portions of the selected segment. The result of this first step is a finite-length, discrete-time signal. In theory, we can compute the frequency content of such a signal by applying the DTFT equation. However, since that equation requires integration, this computation is not practical for arbitrary signals and digital computers. Even though we will not compute this integral, it is helpful to our understanding of spectral analysis to refer to the DTFT of the windowed segment, or the underlying DTFT.

The second step is to actually compute the DFT of the windowed segment. The DFT produces a discrete-frequency representation directly from a discrete-time signal by computing a finite weighted sum. This is in contrast to the DTFT, which requires integration and produces a continuous-frequency representation. The DFT's discrete-frequency representation constitutes samples of the underlying DTFT. The DFT length determines the spacing of these frequency samples, but not the frequency resolution of the spectral analysis, which is determined by the window length and shape. These specific effects of the DFT are described in detail elsewhere in this tutorial.

The spectral analysis demo that accompanies this tutorial allows you to select the input signal, window length, window shape, and DFT length. It produces three frequency-domain plots: the DTFT of the window, the (underlying) DTFT of the windowed segment, and the DFT of the windowed segment. When discussing frequency resolution, it is often helpful to compare the DTFTs, although it is important to note that only the DFT of the windowed segment is actually calculated for spectral analysis and the two DTFT's are only provided to assist our understanding of the process.

Effect of Windowing

When the window is applied to the original signal by multiplication in the time domain, the window is convolved with the signal in the frequency domain. Since the ideal window should have no effect on the spectral content of the original signal, its frequency domain representation should be an impulse. Unfortunately, this means that the ideal window has infinite extent in the time domain, making it not a window at all. But this gives us insight into the relevant characteristics of a window: the more its frequency-domain representation resembles an impulse, the ''better'' the window.

The frequency-domain representation of a window deviates from an impulse in two main ways. First, the mainlobe has non-zero width, compared to an impulse with zero width. Second, the sidelobes are nonzero outside the mainlobe, compared to an impulse which is zero ''everywhere else''. As a result, applying a window affects the spectral content of the signal, by spreading each single frequency component with a pattern that matches the magnitude of the window's frequency-domain representation.

Effect of DFT

The DFT computes frequency samples of the underlying DTFT. (Recall that we'd prefer to compute the underlying DTFT, but that would require integration.) The minimum meaningful DFT length in spectral analysis is equal to the window length. Using a longer DFT length provides more closely spaced frequency samples. This is accomplished by padding the windowed segment with zeros to match the desired DFT length and then computing the DFT. Longer DFT lengths provide more accurate visual representations of the underlying DTFTs. In many cases, this provides a more accurate representation of the spectral content revealed by the underlying DTFT.

Computing an N-point DFT produces X[k] for k=0,...,N-1. These N values correspond to uniformly-spaced frequency samples of the DTFT, X(f) at values of f=k/N. If the discrete-time signal was obtained by sampling a continuous-time signal at sampling frequency Fs, then the original continuous-time frequencies are related by F=fFs=kFs/N.

Frequency Resolution

Frequency resolution is determined by the window's mainlobe width, which is related to the window's length and shape (See Window Characteristics). When the window is applied to the original signal by multiplication in the time domain, the window is convolved with the signal in the frequency domain. In this convolution, the window's mainlobe causes spectral smearing, or spreading of a particular frequency to neighboring frequencies. To see this effect on the sum of two cosines, try the following parameter values in the demo: Note the significance of the window's mainlobe width as the frequency difference between the two cosines decreases, by generating plots for the different frequency spacings.

In order to resolve neighboring frequencies, we require that the window's mainlobe width be less than or equal to the desired frequency resolution. In this case the underlying DTFT will show separate peaks for neighboring frequency components separated by the width of the window's mainlobe as measured between first zero crossings. (The mainlobe width of a rectangular window is 2/M, where M is the window length.)

When we know that the original signal is a sum of two cosines, then each peak in the windowed signal's DTFT has the same width, because it is formed by convolving the window's mainlobe with the underlying impulse in frequency. In this case we are confident that a peak in the windowed signal's DTFT is due to a single frequency component at the center frequency of the peak. Arbitrary signals, on the other hand, do not have DTFT's consisting only of impulses. Therefore, for arbitrary signals, the width of features in the windowed signal's DTFT result from both the mainlobe width of the window and the shape of those features in the original signal. Even so, the above description of frequency resolution applies to arbitrary signals as well, quantifying our ability to attribute features in the windowed signal's DTFT to a particular range of frequencies in the original signal.

We can improve the frequency resolution and reduce spectral smearing by using a window with a narrower mainlobe. One way to get a narrower mainlobe is to use a longer window. (Try using a 64-point window in the above example and compare the results for two window lengths with f1=0.12. Then repeat the exercise with shorter and longer windows and different frequency spacings.)

Another way to get a narrower mainlobe (to improve the frequency resolution) is to change the window shape. (For the above example with f1=0.12, compare 100-point rectangular and Hamming windows. Then experiment with different window shapes, window lengths, and frequency spacings.)

Amplitude Resolution

Amplitude resolution is determined by the window's sidelobes. When the window is applied to the original signal by multiplication in the time domain, the window is convolved with the signal in the frequency domain. In this convolution, the window's sidelobes cause some `leakage' of frequency components to many other, possibly distant, frequencies. As a result, `leakage' from a strong frequency component may mask a weak frequency component. To see this effect on the sum of two cosines, try the following parameter values in the demo: Note the significance of the window's sidelobes as the amplitude difference between the two cosines increases, by generating plots for other amplitudes.

We can improve the amplitude resolution by using a window with lower sidelobes. The easiest way to get lower sidelobes is to change the window shape. (Try using a Hamming window in the above example the above example and compare the results with the rectangular window for A1=0.05.)

Window Characteristics

A window is a signal used in the time-domain to extract a segment of another signal. The window is applied by multiplication in the time domain, which corresponds to convolution in frequency. Therefore it is important to understand the frequency-domain characteristics of a window in order to interpret a window's effects.

The two characteristics that define a window in the time domain are the window length and shape. The two most relevant window characteristics in the frequency domain are the mainlobe width and the sidelobe height. The relationships between window length, mainlobe width, and sidelobe height are summarized in the following table for a number of commonly used window shapes.

Window Shape Relative peak Approx. mainlobe width
  sidelobe magnitude (in frequency)
Rectangular/boxcar -13 dB 2/M
Bartlett (triangle) -26 dB 4/M
Hanning (raised cosine) -31 dB 4/M
Hamming (rasied cosine on pedestal -42 dB 4/M
Blackman -58 dB 6/M

Window shapes in frequency domain (linear and dB)

Window shapes in time domain



copyright 2001-2008,
Julie E. Greenberg and Natalie T. Smith