# Why do we not use square filters without windows? [duplicate]

This question may sound like "why do we use window functions", but it's not. So here it's:

What we currently do: If we have a function $g(t)$ and its Fourier transform $G(f)$, and a window $W(f)$ and its time domain version $w(t)$, where $t$ is time and $f$ is frequency. The convolution theorem says that convolving $g(t)$ and $w(t)$ is equivalent to multiplying the spectra of each of them. So, to apply a low-pass filter, we ideally apply a square filter at some cut-off frequency. But this doesn't work, because then $w(t)$ has to be infinitely long, because the Fourier transform of the the square window I have to apply is an infinitely long sinc. So to get rid of this sinc, we apply the window to minimize the side-lobes.

This whole story is fine, but here's my problem: This whole story is based on that we're doing all this in the time domain, and hence we use convolution. But consider this (which I know is not an innovation, but I want to understand why that doesn't work): I take my function $g(t)$, calculate its Discrete Fourier transform $G(f)$, multiply it by my perfect square window and filter the spectrum (or in other words, remove the frequencies that I don't like), and then do the reverse transform. What's the problem with that?

• The transform of an ideal window in the freq domain (which passes both positive and negative freqs) is a sinc that is centered at t=0. This is a problem, because that sinc filter is not causal. It's fine to do discrete convolution with a sampled sinc, but you have to shift it so there's nothing before t=0. – CMDoolittle Nov 21 '16 at 23:13
• uhm, a window is not the same as an impulse response. maybe you might change "$w(t)$" (and "$W(f)$") to "$h(t)$" (and "$H(f)$") if you want to leave the words "convolving" and "multiplying" where they are. or you can keep "$w(t)$" and "$W(f)$" and swap the position of words "convolving" and "multiplying". – robert bristow-johnson Nov 21 '16 at 23:15
• You must to see answer to question - dsp.stackexchange.com/questions/6220/… – SergV Nov 22 '16 at 3:36

As robert mentioned: Please use the terms convolution and window formally correct in your question!

There's no problem with that aside from the fact that we can't take an infinitely long Fourier transform within finite time!

That's not really a problem, though – through clever overlapping and using the linearity properties of the (discrete) Fourier transform, we can still get valid results that are identical by converting parts of the signal to the frequency domain, multiplying them with the pre-transformed filter, and then converting back to time domain.

You need to ensure that the DFT size and overlap are appropriate, but if you do that, you end up with the well-known overlap-add or overlap-save methods of convolution.

These methods are widely used in DSP! For example, I know for a fact that some hardware / FPGA-base channel emulators and simulators do in fact use a 1024-point FFT, the overlap-add method and a 1024-IFFT.

On general purpose computing hardware (read: PCs and similar computers), FFT filters following that principle are very handy, as they are much more efficient then convolution in time domain.

For example GNU Radio has such filters and they are blazingly fast. Think of dozens to hundreds of million complex-valued samples convolved with multiple-thousand-tap filters!

Since you're a physicist, you might also be interested in the analog side of things: There's actually ways to physically implement or at least approximate a Fourier transform, and those are used for exactly these kind of things. For example, lenses all have a Fourier transform property!

• i'd like to get the OP to get the semantics down correctly before i respond with an answer. another problem is that the DFT works on discrete functions (or sequences), not "$g(t)$". – robert bristow-johnson Nov 21 '16 at 23:18
• @robertbristow-johnson I fully get your point, but this was the last post I wanted to write today, and I was hoping OP would get his question sorted out faster than I wrote my answer. – Marcus Müller Nov 21 '16 at 23:21
• Also, OP claims he's a quantum physicist. Well. k-Space is quantized, so he'd better be used to discretized things! – Marcus Müller Nov 21 '16 at 23:21
• names or handles are not quite the same as a claim. – robert bristow-johnson Nov 21 '16 at 23:24
• Well, I did think you claimed to be robert bristow-johnson :D – Marcus Müller Nov 21 '16 at 23:26