# What is the difference of windowing functions for FIR filtering?

What is the difference of window types such as Hann, Rectangular, Hamming in the application. Is there such a thing that the one is better than the other?

• huh, that's a question that sounds a lot like homework - what are your thoughts on this so far? What have you looked into? There's quite a bit on window functions out there (e.g. wikipedia), and I think you can give us an easier start at helping you when you try to describe your current research in a little more detail Jun 7, 2020 at 14:39
• Awesome! I'm adding that to your question, because it greatly improves it. Jun 7, 2020 at 15:21
• So, I think the oral examiner might ask you something like "why does main lobe width of our window function matter for our filter?" (more than they would ask "List windows and their applications"), so that information really changes your question quite a bit (and for the better, honestly!). So, let's actually work with that. It sounds like you already know what the window function in FIR filter design is used for, is that right? Jun 7, 2020 at 15:24
• Yes, but unfortunately I didn't understand the idea behind exactly these kind of questions that you addressed Sir. Jun 7, 2020 at 15:29
• that's what we'll be working on :)! (no need to call me "Sir", please. I'm probably not that much older, and certainly not more respectable than you are!) Jun 7, 2020 at 15:33

So, from the discussion in the comments it's clear you know most you need to know.

The window method for FIR filter design is based on this idea:

1. We know the "ideal" frequency response $$H(f)$$ we want. Often, that's something like a rectangle in frequency design.
2. Well, the easiest thing to achieve that shape would simply be transforming $$H$$ to time domain, yielding the impulse response $$h(t) = \mathcal F^{-1}\{H\}(t)$$.
3. small problem here: If $$H(f)$$ is very steep, then the properties of the Fourier transform implies that $$h(t)$$ will be very long – in fact, if $$H(f)$$ is a rectangle (we call that the "brickwall" or "boxcar" filter, by the way), then $$h(t)$$ will be a sinc; and that is infinitely long. That's not useful for a FIR....
4. So we decide we need to cut off $$h(t)$$ after some length. Now, if we simply decide to cut off at some point, we have multiplied with a rectangular window $$w_\text{rectangle}$$, and we know that this is equivalent with convolving with a sinc in frequency domain. And convolving our nice ideal frequency response $$H(f)$$ with a sinc will totally "smear" and make it round and wobbly – not really what we want, usually.
5. Therefore, instead of using the rectangular window, we use a "rounder" window.
6. Thus, we realize we need to find a trade-off between being "sharp" in frequency and not "too smoothly running out" in time domain (because that means our filter remains long).

Now, the filters you mention have different properties, and were all designed to fulfill some roles.

For example, the Hamming window has a very nicely suppressed first sidelobe in frequency domain – which means that after convolving our ideal $$H$$ with it, the transition from passband to stop band will show the same nice behaviour, and signals close to the edge of the passband are already well suppressed. That might be useful when you want to extract a single channel from many channels that lie close together in spectrum.

Hann, on the other hand, doesn't suppress the first sidelobe as much - but in exchange, the power of the sidelobes drop faster the further you get from the mainlobe. This helps you if you want to design e.g. an anti-aliasing filter, where all the frequency that you don't suppress ends up aliased in the passband.

Now, for your oral exam: Maybe head over to wikipedia's list of window functions, and look at the frequency domain plots of them. When your examiner asks you what the up- and downsides for a given window for a given application are, you'd start by explaining that you need to convolve the ideal frequency response with the spectrum of the window, and then work your way towards an answer.

If your examiner is like any of the examiners that I was the transcript writer for (or any examiner that orally examined me when I was still a student), then that ability to work towards a solution based on an understanding of windowing and an analysis of what the application calls for is far more interesting than the ability to have an answer to the question "What window will you use for designing an anti-aliasing filter?" instantly ready.

• Thank you very very much, it is a great and detailed explanation. Now everything is much clear. Jun 7, 2020 at 15:55
• You're utterly welcome! All the best for your exam :) by the way, you say "oral exam for DSP course": May I be as curious as ask what you study? Electrical Engineering? Bioinformatics? Computer Science? Jun 7, 2020 at 15:58
• Biomedical Engineering and the course is Biomedical Signal Processing. So we were applying different filters in order to remove noises or interferences in ECG signals. Thank you, I hope so! :) Jun 7, 2020 at 16:12
• That sounds pretty cool! Again, all the best for your exam, and your studies Jun 7, 2020 at 16:25
• Thank you, also for your helps! Jun 7, 2020 at 16:50