## What is Windowing and when/why do we need it?

Started by 2 years ago8 replieslatest reply 2 years ago2555 views

This is the first question to make it into the new #FAQ section.

The hope is that your collective insights will make this page a great resource for the EE community to learn about the basics of Windowing in the DSP world:  what it is, when and why we need it, when we don't need it, Matlab examples, etc.

1. that you can add images to your post simply by drag and dropping them into the editor
2. that you can add great looking equations to your post through Mathjax (read here for details)
3. to click on the 'thumbs up' button for the contributions that you find the most insightful

In the hope to encourage the participation of many, I will start keeping track of the total number of thumbs-ups every user receives for FAQs.  From time to time, I will draw a prize (a dsp book probably) to be sent to the winner.  The more thumbs-ups you accumulate, the more chances you have to win the prize.

Thanks a lot for your time!

[ - ]

"Windowing" can mean a couple of things:

1) A limitation in temporal or spatial or spectral extent (etc.) - whether intentional or simply a function of the limitations of observation or measurement.  The "limitation" may also be a single period of a periodic function or record.  [From now on, I'll use "time" with the understanding that it may be "frequency" or "space" or ....]

2) A finite function applied to (multiplied) over a time function or record in order to achieve a desired effect.

So, in (1), we may refer to an "observation window" meaning that there is an observation or measurement time that is either selected or imposed.  This by itself has no weighting involved and is called a "rectangular window" or "gate function", etc.  Importantly, the Fourier transform of a rectangular window is of the form sinx/x or what's called a "sinc" function.  This is a fundamental characteristic. The shorter the rectangular window, the wider the sinc and vice versa.  Thus the reference to the Heisenberg uncertainty principle.

In (2), we impose a weighting function over the rectangular window.  Why would we do this?  For example, the sharp edges of the rectangular window in time introduce broad spectral content. And, broad spectral content is detrimental to spectral analysis.

Imagine a rectangular window that's multiplied by a bell-shaped curve - clearly this will remove the sharp transitions at the ends and reduce the broad spectral energy that the sharp edges contain.

A good deal of effort has gone into analyzing and designing such "windows" or "weighting functions" with the idea of helping one understand their characteristics and to help one implement them efficiently.   Some key references are:

"On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform" Fredric J. Harris, Proceedings IEEE, vol. 66, pp 51-83

Nuttall, A. H. (February 1981). "Some windows with very good sidelobe behavior". IEEE Transactions on Acoustics, Speech, Signal Processing. ASSP-29: 84–91.

G.C. Temes, V. Barcilon, and F.C. Marshall III. The optimization of bandlimited systems. Proc. IEEE, Vol 61, pages 196-234, 1973.

[ - ]

Sometimes we have to teach new hires about windowing on a basic level.  They've already seen it in school, but maybe don't "feel" the need, and just think of it on a list that includes lots of signal processing concepts.  We show them a waveform, say 10000 samples, and ask them how they would apply an FFT to it in Matlab.  Of course they always know Matlab (or Octave), so they give a Matlab'ish type answer and it's easy.  Then we ask, now what if you have to do this to continuous data -- you can't see the end of it, and it may never stop ?

Most say something like "process it in chunks".  Some add something like "make sure we keep up with the data".  And that starts a conversation about how to determine the chunk size, how to deal with the edges of the chunk ("truncation" has been mentioned already), how to sew the chunks together, and how to make processing each chunk efficient.  What we want them to keep in mind is that windowing is fundamental to handling continuous streams of data.

[ - ]

Here are two on-line references on how windows are used in DSP:

In spectral analysis:

http://www.dspguide.com/CH9.PDF

In filter design:

http://www.dspguide.com/CH16.PDF

[ - ]

Hi Steve.   Nice to hear from you.

[-Rick-]

[ - ]

It is deeply and fundamentally mathematical.  It is actually related to Heisenberg's uncertainty and is called The Gabor Limit.  The more precise you know things in time, the less precisely you can know their frequency ... and ... vice-versa.

Any truncated time-domain sequence MUST have an infinite frequency-domain sequence.

Any truncated frequency-domain sequence MUST have an infinite time-domain sequence.

To demonstrate ... as you crank up the Alpha of a Keyser or Dolph filter, the time window gets narrower and making time more accurate (throwing away information, by the way) while the stopband gets deeper and deeper with the main lobe widening, so the frequency information becomes LESS specific.

The best we can hope for is a tapering where some time or frequency region is significant and outside of that region the information has been "Windowed-out" to become insignificant.  Window shapes in the time or frequency domains are chosen to optimize some needed parameter.  Sometimes that optimization is selecting single-frequency boomer out of the otherwise flat background noise, for this a Dolph is optimal, and a Blackman-Harris is really fast and easy to calculate.  Sometimes, we need the least distortion of the peak amplitude for some spectral analysis reason.  At this point you might get Remez going or use one of the Flat-Top windows.  The rectangular window (also known as Dirichlet) is the best there is at providing an unbiased estimator when you DON'T KNOW whether you are working on broadband or narrowband signals.

The point is that you have to look at the work you are doing to choose the right Window function.

The most egalitarian window is Gaussian.  It gives the same tail shapes in time as it gives in frequency and they tail off really fast.

Hope this helps.

from a 40-year DSP veteran.

[ - ]

Windowing, to my best understanding, is

In Signal processing:

1.to trancate signals which are of your interest

2.to reduce memory requirement and accelerate computation process

In filter design: to make FIR filter

I think windowing is needed out of practical reasons. In the context of signal processing, almost all signals we are interested in are restrained to a certain period of time(For example, In a radar system, we usually analysis the received signal within a duration of a few pulses), thus by windowing we get useful signals. In the context of filter design, there is a filter type of FIR(finite impluse reponse), the design technique lies on windowing. There are plenty of prototypes out there, all you need to do is to apply windowing and make it implementable and computational effective.

From a university student in his forth year

[ - ]