1
$\begingroup$

I know we can use window function to decrease leakage phenomenon by making the end of a non-periodic signal to be zero at both end, so that to make it like "continuous and periodic" when doing fft.

However, when we multiply window function with original signal (ex: w(t)xs(t)), it's like doing convolution (w(f)*s(f)) in frequency domain, just like w(f) function slide from left to right and integrate with the area with s(f).

And my question is that since it would still integrate the area which is not the real frequencies of the original signal, and have values after convolution, how could this method really suppress those frequencies?

What make me confused is because I think using window function is the same as the method of doing FIR, which also multiple a window function with the ideal low pass signal in frequency domain. And the FIR characteristics are related to how many areas during integration (ex: the size of transition band).

Thank you very much!

$\endgroup$

3 Answers 3

0
$\begingroup$

Perhaps a Simple example using a hanning window might be helpful

Let's compare the DFT of a Hanning (or Von Hann) window and what you get by doing the convolution in the frequency domain.

A Hanning window can be reduced to 3 terms in the frequency domain

$$ \hat{X(k)}_{\text{Hanning}}= .5 X(k) + .25 ( X(k-1) + X(k+1)) $$ where $X(k)$ are the DFT bins of a time domain uniform window and the k are wrapped around at the edges. $\hat{X(k)}_{\text{Hanning}}$ is the DFT bin value of a Hanning windowed time signal. For this example $x[n]=1$ for $n=0,1,2,\dots 127$, and zero otherwise.

clear all
x=fft(boxcar(128))';
xh=fft(hanning(128))';
figure(1)
 y= .5*x + .25*( [x(128) x(1:127)]+[x(2:128) x(1)] );
plot(fftshift(abs(y)),'x')
title('Frequency Domain Hanning')
figure(2)
plot(fftshift(abs(xh)),'x')
title('time domain Hanning')

[DFT of Hanning wido by convolution in the frequency domain][DFT of Hanning widow by convolution in the frequency domain

[DFT of Hanning window taken in the time domain][DFT of Hanning window taken in the time domain]

The plots are identical which shows that you can convolve in the frequency domain.

Unlike time domain convolution, we have all the frequency domain terms so the convolution isn't "causal". Windowing has the effect of smoothing in the frequency domain. Each term is smoothed so the symmetry in the frequency domain is preserved. The original symmetry and periodic nature of the DFT ensures that even at the edges, in the frequency domain, they are neighbors.

A time domain window acts on all the frequencies, negative and positive. The term "real frequencies", in my opinion, contributes to your confusion.

$\endgroup$
9
  • $\begingroup$ Just a nitpick. "Hanning" is not the proper name, it should be "VonHann". "Hanning" comes from the similarity to "Hamming" which is a different window type. It doesn't help that the Python library reinforces this misnomer. Not that much of a biggie to me, but I have found in various forums it is somewhat of a hot button issue for some folks. FYI. $\endgroup$ Commented Aug 5, 2018 at 15:34
  • $\begingroup$ that’s what the mathworks calls it. proper or not, the name sticks $\endgroup$
    – user28715
    Commented Aug 5, 2018 at 16:18
  • $\begingroup$ I don't disagree. Even harris called it that. I am not going to lose any sleep over it. I was just pointing it out as there are some members of the community who have an issue with it. $\endgroup$ Commented Aug 5, 2018 at 16:38
  • $\begingroup$ There are these 2 arrows, one goes up and the other goes down at the top left of the answer. If anyone is deeply offended because I used hanning, please feel free to down vote the answer. Otherwise I would prefer the answer be judged on its signal Processing merits. $\endgroup$
    – user28715
    Commented Aug 5, 2018 at 17:20
  • $\begingroup$ It would be a shame for someone to downvote you for that. However, your "time domain Hanning" chart should look like a one plus cosine or a sine squared graph, it seems you have duplicated the frequency graph. $\endgroup$ Commented Aug 5, 2018 at 17:44
0
$\begingroup$

Your question is a little bit muddled since you are conflating concepts from the discrete case and the continuous case. Leakage is a phenomenon of the discrete case. There is no integration involved, that is from the continuous case. In the discrete case it is a summation.

Leakage occurs for a pure tone when it's frequency is not a whole integer on the sampling frame. You can find exact formulas for leakage in this situation in my blog article DFT Bin Value Formulas for Pure Real Tones. As far as I know, you will not find these formulas, or their equivalents, anywhere else.

The formula reveals, as observation will show, that the leakage is near linear as you move away from the peak. The VonHann (aka Hanning) is a good example of how a window function can supress the leakage. The VonHann coefficients (-.25,.50,-.25) when applied to a linear sequence (m-d,m,m+d) results in a zero, thus the VonHann window removes the linear component of the leakage values leaving just the smaller non-linear portion. There is a sign flip on either side of the peak so this does not apply there.

The ostensible purpose of window functions is to narrow the lobe around the peak by reducing the leakage. This allows for the "demasking" of nearby frequencies on the spectrum. A better approach is to estimate the parameters of the larger peak and remove its effects from the DFT. This can be done in the time domain and another DFT taken, or it can be done directly in the frequency domain using the formulas in my blog article.

$\endgroup$
3
  • $\begingroup$ just a nit. ostensible means being such in appearance : plausible rather than demonstrably true or real. Do you really mean ostensible? $\endgroup$
    – user28715
    Commented Aug 5, 2018 at 18:36
  • $\begingroup$ @StanleyPawlukiewicz. There might be a better word, but when the signal is a pure tone at, or very near, an integer frequency the window function actually introduces leakage, i.e. broadens the peak. As an aside, I don't care for the term "leakage" as the implication is that it is somehow a flaw of the DFT rather than its inherent nature. I don't have a better alternative though, "side lobes" is just as bad in my opinion. $\endgroup$ Commented Aug 5, 2018 at 18:59
  • $\begingroup$ Hi, thank you for providing this great article, I'll read and try to realize! : ) $\endgroup$
    – Yui
    Commented Aug 6, 2018 at 5:02
0
$\begingroup$

You are right that the effect of windowing is the same for the design of FIR filters and for spectral analysis. You will always have a compromise between main lobe width and relative side lobe level (relative to the main lobe). The main lobe width determines the frequency resolution, and the relative side lobe level determines the amount of spectral leakage. A rectangular window has a narrow main lobe (desirable), and relatively large side lobes (undesirable). Other windows achieve different compromises between those two parameters. In FIR filter design, the equivalents to frequency resolution (main lobe width) and leakage (side lobe level) are transition band width and stop band rejection.

You should read the classic paper by Fred Harris: On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform.

$\endgroup$
3
  • $\begingroup$ Just a quirk, but he prefers "fred harris". I agree that this is the seminal paper on the topic. I wish someone would make a proper PDF of it rather than the low quality image ones that are available. $\endgroup$ Commented Aug 5, 2018 at 15:36
  • 1
    $\begingroup$ @CedronDawg: I replaced the link with a much better quality pdf file. $\endgroup$
    – Matt L.
    Commented Aug 8, 2018 at 11:28
  • $\begingroup$ Thanks, not only is that better quality, it is also searchable which is what I meant by a proper PDF. The text is not sequential though in a columnar sense, making cutting and pasting difficult, but it is a huge improvement over the poorly imaged version. As to the point I made to @StanleyPawlukiewicz, check out footnote 1 on page 60: 'The correct name of this window is “Hann.” The term “Hanning” is used in this report to reflect conventional usage. The derived term “Hann’d” is also widely used.' $\endgroup$ Commented Aug 8, 2018 at 14:20

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.