# Dropping the zeros at the edge of window functions

I have learned that Scipy's implementation of the Hann window allows receiving both a symmetric window, and a periodic window (meaning the last zero element is dropped). As far as I understand, the periodic window is preferable for the DFT as it has a thinner main lob.

1. Based on the same logic, the Hanning window, a Hann window with both edges dropped, would have even better performance. Why is it not used?
2. Why are symmetric windows preferable for filter design?

Later comment

Maybe it is related to the phase consistency. What about the Welch method for which it is non-relevant?

• "Hanning window" is just a misnomer for Hann window. They are the same thing. But some dumb electrical engineer somewhere did a portamento between "Hann" (a real window) and "Hamming" (another real window very similar to Hann) to get "Hanning". Sep 20, 2023 at 22:09
• While I agree, for some reason Matlab still insists on having returning different values for hann() and hanning(). The equation is the same (generalized cosine window) but, for a window of size $N$, $\text{Hann}(n) = 0.5 - 0.5\cos(2\pi n / (N-1)), \, 0\leq n <= N-1$, $\text{Hanning}(n) = 0.5 - 0.5\cos(2\pi n / (N+1)), \, 1 \leq n <= N$
– Jdip
Sep 20, 2023 at 23:32

As far as I understand, the periodic window is preferable for the DFT as it has a thinner main lob.

Not only. For windows such as Hamming or Hann of even length, which are usually used in OLA processing, only periodic windows can satisfy COLA constraints. See also this.

With that being said,

1. Thinner main lobe usually comes with its set of compromises, such as Equivalent Noise Bandwidth, side lobe roll-off rate, and side lobe height. The Hanning window has a thinner main lobe, but higher side lobes than the Hann window.
2. Because you generally want your filter to be symmetric so that the phase is perfectly linear (i.e. constant group delay).
• Ok. For 1,so why we drop one zero than? With this logic, we might prefer having no drops at all, right? Sep 20, 2023 at 21:18
• I'm not sure I get your question. You might prefer a window that gives you better frequency precision, or less spectral leakage, or better ENBW... depends on your application. As far as "dropping one zero", in the special case of hann, it's to make it periodic. If you don't then it's symmetric
– Jdip
Sep 20, 2023 at 22:57
• So, considering you answer, why periodic is preferred over symmetric for stft? Sep 21, 2023 at 3:23
• My assumption is that it is preferred to provide specific central sample, contrary to what you suggested but I might be wrong or misinterpreted your answer. Sep 21, 2023 at 3:30
• I've edited my answer with a few useful links for you. If you need more in depth explanation, feel free to ask a new question, I'll try to answer when I have more bandwidth ;)
– Jdip
Sep 21, 2023 at 19:22