EE 464 Fall 2014 T. R. Fischer Notes on the use of Windows with the DFT for Spectral Analysis Let x(t) = 200 cos(2pi f1 t) + cos(2pi f2 t), 1/T = 2048, and sample x(t) at t = nT, n = 0,…, 127. The signal and its DFT magnitude spectrum are plotted below for f1 = 64 and f2 = 272 Hz. Because the two cosine frequencies are integral multiples of 1/(NT) = 16 Hz, the DFT gives samples of sinc(.) functions at exactly the zero crossings. The magnitude (in dB) is thresholded to not go below -160 dB in the figure. The difference in peak magnitudes is 46 dB. The cosine frequencies are now changed to f1 = 67 and f2 = 275 Hz. The spectrum is shown below. The small-amplitude cosine is nearly lost, even on a decibel scale. The cosine frequencies are again f1 = 65 and f2 = 275 Hz. However, now a Hanning window is used to truncate the signal. Note the resulting shaping of the time waveform. The second cosine is clearly visible in the spectrum. Note also that the width of the main lobe increases significantly over the case of the rectangular window. A variety of windows are useful for spectral analysis. Four windows are a. the rectangular window; b. the triangular (or Bartlett) window; c. the Hanning window, w(n) = 0.5[1 – cos(2∏n/N), n=0,…, N-1; and d. the Blackman window, w(n) = 0.42 - 0.5 cos(2∏n/N) + 0.08 cos(4∏n/N), n=0,…, N-1. These windows, and their corresponding spectrum are shown in the figure below. As the window changes (top to bottom in figure) from rectangular to Bartlett to Hanning to Blackman, the time waveform becomes more smoothly tapered to zero at the edges, the attenuation of the spectral sidelobes increases, and the width of the main spectral lobe increases. A note about Matlab: Matlab has built-in functions for many windows. However, the window varies slightly between FIR filter design and spectral analysis using DFT applications. For linear phase FIR filter design, the symmetric window should be used this is the default Matlab instruction. To generate the periodic version (for use with the DFT) use the command >> w = hamming(N, ‘periodic’); to generate the window, w., Figure 4. From top to bottom: Rectangular, triangular (Bartlett), Hanning, and Blackman windows: time samples on left (of length N=64); DFT on right (using zero padding and length 512 DFT).
© Copyright 2026 Paperzz