1
\$\begingroup\$

As far as my understanding goes, windows in the FFT can be used to reduce the leakage error.

Suppose that I need to sample a continuous time sinusoidal signal s(t) with frequency \$F = 10 Hz\$. Suppose the sampling frequency \$Fs = 100 Hz\$.

Suppose that the synchronous sampling condition is met, ie \$MF = F_s\$ where \$M\$ is the number of samples with \$M=10\$. Then the signal spectrum looks like this

enter image description here

This is completely correct since the frequency resolution is

$$\frac{F_s}{M}=10 Hz/bin$$.

Now suppose of using a Hamming Window, (there is no need for the window here but let's use it for the sake of my argument). Hamming window has order L=2 which means that the width of the main lobe of the window's spectrum is:

$$\frac{2 \pi}{M T_s} L = \frac{2 \pi}{M T_s} 2$$

in radians or $$\frac{2L}{M T_s}$$ in Hz.

Now, due to the width of the main lobe, when applying the window I expect to see 2 fake harmonics of equal amplitude in the DFT, which is exactly what I see down here:

enter image description here

However, by doubling the number of samples to M' = 2M = 20 (now we are sampling 2 periods) and the width of the main lobe of the window should be

$$\frac{2 \pi}{M' T_s} L = \frac{2 \pi}{2M T_s} 2 = \frac{2 \pi}{M T_s}$$

which is exactly the width of the main lobe of a rectangular window. This time, in the DFT there should be no fake component and only the real component, however this is clearly not the case as you can see down in this last picture:

enter image description here

Why is this the case? Shouldn't this last picture look like the first one (ie contain only one component instead of three?).

\$\endgroup\$
1
  • \$\begingroup\$ On EE.SE use \$ to open and close inline MathJAX rather than just $. \$\endgroup\$
    – Transistor
    Commented Dec 29, 2017 at 21:42

3 Answers 3

2
\$\begingroup\$

Do you understand that

  • the FT of a sinc() function is a rectangular pulse (and vice-versa)?
  • multiplication in the time domain is equivalent to convolution in the frequency domain (and vice-versa)?

Can you now see why you get that result?

\$\endgroup\$
4
  • \$\begingroup\$ I did not know the 1st point but I knew the 2nd which is exactly why I asked the question.. By making the convolution I don't understand why the fake harmonics pop up. The should pop up, as expeceted in the 2nd image but I don't understand why they appear in the 3rd. Having doubled (in this case) the observation interval should account for the windows main lobe width, shouldn't it? \$\endgroup\$
    – mickkk
    Commented Dec 29, 2017 at 22:04
  • 2
    \$\begingroup\$ No, it doesn't. Remember, you have to imagine that the set of time-domain samples is repeated infinitely in both directions. What is the frequency content of the resulting signal? You're clearly amplitude-modulating the original sinewave at half of its frequency, so it should not be at all surprising to see sidebands pop up at the appropriate offset from the "carrier". \$\endgroup\$
    – Dave Tweed
    Commented Dec 29, 2017 at 22:08
  • 2
    \$\begingroup\$ Any kind of window function will produce this kind of "spreading" of the peaks in the frequency-domain representation. The key is to pick a window that minimizes the kinds of distortion that you care most about in a particular application. It is also why, when you do happen to be sampling whole cycles of a signal synchronously, you DON'T want to use a window function. \$\endgroup\$
    – Dave Tweed
    Commented Dec 29, 2017 at 22:12
  • \$\begingroup\$ I did not think of it in terms of amplitude modulation. This starts to make more sense now.. let me try to make some simulations.. my book on DSP is taking me through an explanation which leads to the conclusion I explained above and frankly it is a bit confusing. \$\endgroup\$
    – mickkk
    Commented Dec 29, 2017 at 22:16
1
\$\begingroup\$

Those extra signals are not 'fake harmonics', they are 'window spread'.

Whenever you multiply your input waveform by a window function, you convolve your ideal spectrum by the window's spectrum, which spreads the main lobe.

In the case of a Hamming window, the main lobe spread is always +/-1 bin.

Window functions are chosen to have spectra that have good properties, generally a narrow (compact) main lobe, and low sidelobes. In your case, with synchronous sampling, you won't see the sidelobe behaviour. When evaluating the performance of windows, we usually use a signal between bin frequencies, so having n+0.5 cycles in the time domain, to maximally excite the undesired frequency spill into other bins. Or better still, n+0.3, so the sidelobes are asymmetric and don't (mis)lead us to believe things are always equal that only happen to be.

The Hamming window is one of a class of so-called 'sum of cosines' windows, which has a main lobe spread of exactly +/- 1 bin. As you're experimenting, look up also the Blackman window, which spreads +/- 2 bins, and the Blackman-Harris, which spreads +/- 3 bins. With synchronous sampling and no sidelobes, you'd fail to see any advantage to these other windows, only a wider main lobe. With an off-integer frequency, you'd see that they suppress the sidelobes far better (over 60dB and 90dB respectively). So much better in fact that you need to switch from a linear to a log (dB) amplitude scale to see the difference.

Different applications value narrow main lobe or low sidebands differently, which is why there's a selection of windows to choose from. In addition to the above mentioned windows, Gaussian and Kaiser-Bessel are the other main popular ones. Apart from designing my own +/- 4 bin spread sum of cosines window (-120dB sidelobes), I've never found a need to use anything other than what's mentioned here.

\$\endgroup\$
0
\$\begingroup\$

The fake harmonics pop up if your time-signal does not exactly repeat in the sampling window. And that requires any components to also exactly repeat in the sampling window. Thus 1us window for 10MHz squarewave, with 313.13Mhz RF tone atop the squarewave, will have aliasing of the 313.13MHz tone.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.