next up previous contents
Next: More on spectral leakge: Up: The windowed DFT Previous: The windowed DFT   Contents


Motivation and theoretical background

The concept of a window was one that I found very difficult to learn. At the begining, all I really wanted to know is 'in what situations should I use which window?' Only later did I take the time to learn all of the details. If you are in that situation, skip this section and go to the next. Or, Wikipedia [2] has some good information on windows and shows the formulas and frequency response of many of them. National Instruments also has a good page [3].

First, the motivation for DFT windows: the DFT is like a set of passband filters, but not a very good one. For example, at a sampling frequency of 1000 Hz with a 1000 point DFT, the first frequency bin is like a bandpass filter from 0 to 1 Hz, the second bin is a bandpass filter from 1 to 2 Hz, the third 2 to 3, etc. But, if we have a signal of 1.1 Hz, we would expect a response in the 2nd bin, but in reality we may also see a response in the 1st and the 3rd bins. This is called spectral leakage.

To see this, remember from section 6.1 that the DFT, like the Fourier series, assumes that the input signal is periodic even if it is not. But that is no problem you say, we are doing vibration work here, of course our signal is periodic. Yes, but there is a subtle catch. If the length of our data sample is not matched to an integer number of periods of the signal, then we get leakage. Consider figure 16. On the far left we have a 1 second long sample of a pure sine wave signal. The top is 4 Hz and the bottom is 4.25 Hz. Note that an integer number of cycles fit into the top sample, but not the bottom sample. In the next column is a periodic extension, which is what the DFT assumes. Note the discontinuity. On the next column is the result of a DFT. The top spectra is what we would expect. But the bottom signal shows non-zero values at many different frequencies. This is caused by the discontinuity 4. Now, in the next column we introduce a windowing function to the FFT. Prior to the FFT the raw signal is multiplied by a Hann window (dashed lines) such that the function is zero valued at the begining and end of the interval. Thus, the periodic extension will have no discontinuities. The far right column shows the windowed DFT.

Note the following things: in the bottom row, the Hann window has reduced the leakage in the bins far away from the signal frequency, at the expense of adding a little leakage that was not there originally in the top row. Whether this is a good trade depends on your application. The next sections describe different applications that arise commonly and describe the best windows to use for those tasks.

Note that the window ``throws away'' some of the energy that is at the begining and ends of the interval. Therefore, if we just take the FFT of the windowed signal, the amplitude will be reduced. We can correct for that by multiplying by a correction factor based on the average value of the window ( length(win) / sum(win) in Matlab). For the hann window, this amounts to multiplying the signal by 2, since the area under the curve is half of the original signal.

Figure 16: Example of spectral leakage. Columns from left to right: original signals, periodic extension, DFT, windowed signals, DFT w/ Hann window. Top: 4 Hz. Bottom: 4.25 Hz. Applying the Hann window has reduced spectral leakage in the bottom case, but actually increased the leakage in the top case. Of course, the situation in the top case rarely occurs in practice, so we are not concerned about it.
Image leakage



Footnotes

...4
in a more general sense, we also want the first several derivatives of the data to be continuous at the ends as well. In mathematical terms, we want the data to be smooth. So for example, if a half-integer number of cycles fit into the interval, there is no discontinuity, but the first derivative is not continuous at the periodic extension, and thus there will be leakage.

next up previous contents
Next: More on spectral leakge: Up: The windowed DFT Previous: The windowed DFT   Contents " . $row['Name'] . " Posted on " . $row['DateTime']; echo "
"; echo $row['Comment']; echo "

"; } echo "
"; ?> Leave a comment on this page:

Name: (optional)
To prove you are not a robot, what is 2+3?

Creative Commons License
This work by Daniel Kiracofe (daniel dot kiracofe at gmail dot com) is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License./' $I