# gaussian window for designing filters in DSP

I understand that we do not use rectangular window as a window in filter design because of the ringing/gibbs artifacts due to the sidelobes of the resulting sinc function in the time domain.

Consequently, most DSP books mention hanning, hamming windows because they reduce the ringing artifacts.

But how about using a simple gaussian window? It is symmetric, invest DFT will also be gaussian which will have much lesser sidelobes than sinc function, etc.

Is the ringing artifact less for hanning window than the Gaussian window? For me a narrow transition band is not the topmost priority.

• "performance": what's that to you? Can you put a number that depends on the pulse shape to "performance"? As soon as you do that, you can compare different windows according to that measure of performance. There's no "generally better" or "generally worse" things, only things that are good for a specific use case with a specific metric of goodness! Your Gauss window might be great! But only for some things, not for others. Jan 28, 2021 at 14:08
• Great overview of different window functions and their properties (including Gaussian). Pick whatever tradeoffs are best for your specific applications. en.wikipedia.org/wiki/Window_function Jan 28, 2021 at 14:19
• The von Hann and Hamming windows are 0 outside of the window size, unlike the Gaussian window (which only ever approaches 0). That's most likely why their use is more wide-spread. Jan 28, 2021 at 14:23
• @Sevag Anyways I am going to use a truncated gaussian window. So infinite length is not a concern to me. Jan 28, 2021 at 15:01
• @MarcusMüller For me the one which gives the least ringing in time domain is the one I prefer and is what i meant by "performance". The transition band may not be narrow that's alright. I have edited my question based on your comment. Jan 28, 2021 at 15:03

First, a Gaussian window will have some parameter controlling the ‘width’ of the Gaussian pulse. So there is no singular Gaussian window like there would be with many other window types.

Second, because it is a window, it has a defined beginning and end such that the signal function is zero outside the window. The is mathematically equivalent to multiplying your Gaussian function with a rectangular window this means the resulting frequency response is the convolution of the gaussian frequency response and the rectangular frequency response, which will contain side lobes (ringing). The magnitudes of the side lobes are a function of the window length and the pulse width. Whether or not the side lobes are better or worse than, say, a Hanning window depends on how you define those parameters and what your metrics are.

Lastly, and this wasn’t explicitly called out but is probably relevant, is discritization. If you are using the resulting window function as part of a discrete time process (in software, for example) the number of samples in the window will effect the frequency response. Every continuous time window function has an infinite bandwidth frequency response because the time domain response is limited. As such, aliasing will occur and the discrete time frequency response will change. The amount it changes is minimized by increasing the number of samples in the window, either by increasing the window length, or increasing the sample rate.

The choice of window is a tradeoff between various different properties: main lobe width, time domain extension, side lobe locations and amplitudes, pass band flatness, stop band attenuation, transition width, re-constructability, time domain discontinuities, etc.

Each window type represents a certain set of tradeoffs and you should choose the one that's the best match for your specific application and requirements.

A truncated Gaussian is just another window-type with it's own set of tradeoffs. If that works for you, great.

For any given window length, their are often better choices: Most window types have been constructed with finite length in mind and they use the available samples "optimally" with respect to the window's goal. Truncating a Gaussian is awkward: if you make it too wide inside the window, the truncation will create significant side lobes and poor stop band attenuation, if you make it too narrow, the main lobe will be very wide.

Recommended reading: https://en.wikipedia.org/wiki/Window_function . The graphs for the different window types are quite useful and they include a few Gaussian flavors.

• Also to add for great reading is fred harris’ classic paper “On the Use of Windowing...”, you can google it. Jan 29, 2021 at 1:11
• Adding to Dan's comment: F.D. Harris, "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform", Proceedings of the IEEE, 66(1), 1978, 51-83. The publication is not protected by U.S. copyright because it is U.S. Government work, so should not be hard to get. The Gaussian window, and many others, are discussed and compared in regard to various figures of merit, performance, etc.
– Ed V
Jan 30, 2021 at 1:58

People tend to use a finite (compactly supported) window function, which makes it amenable to computation. Without this condition, the Gaussian is indeed the best first choice of window filter. It minimizes Fourier uncertainty, which is the most generic and correct metric absent other conditions.

People like to talk about different window functions having different tradeoffs, since you have to measure the error somehow, and every window function is optimal for a given performance function. That kind of answer is a non-answer, because the default performance function comes from the uncertainty principle, and failing to mention this seems like mathematical negligence. This performance function minimizes time and frequency domain error together.

The other window functions, such as Hann/Hamming/rectangular/triangular, make tradeoffs which are inefficient in this respect. These other window functions should only be chosen when special conditions are known that alter the performance function. For example, if a signal has no time-domain information, the widest possible window should be chosen given the input data, which is the full-length rectangular window. Or if you don't care about frequency-domain information, you can use a sinc window (with all lobes, not just the main lobe as in Lanczos). If your signal only has a single frequency that fades in and out, there's probably some special window function I can't think of. As an example of how windowing choice helps, your ears are more accurate in the combined time-frequency domain than the theoretical optimum predicted by the uncertainty principle. It achieves this by making assumptions on the nature of the signal, and these assumptions tend to hold in nature. Pre-knowledge about your signal can help you tailor your window function beyond the default Fourier uncertainty.

With the compact support condition active, the confined Gaussian becomes the best choice. However, when faced with implementation realities, people tend to not use confined Gaussians, likely because it's hard to compute, in addition to some mild laziness. You can simulate it anyway, by using an extra-wide window, with a truncated Gaussian whose standard deviation is extra small. This reduces truncation to an acceptable level. It will take a little longer to compute though.

While the exact confined Gaussian window mention above is hard to compute, it has an almost perfect approximation: the "approximate confined gaussian window" which is simple to compute, see https://www.researchgate.net/publication/261717241_Discrete-time_windows_with_minimal_RMS_bandwidth_for_given_RMS_temporal_width