```bmh161=E6=96=BC 2009=E5=B9=B44=E6=9C=889=E6=97=A5=E6=98=9F=E6=9C=9F=E5=9B=
=9B UTC+8=E4=B8=8B=E5=8D=889=E6=99=8222=E5=88=8655=E7=A7=92=E5=AF=AB=E9=81=
=93=EF=BC=9A
> This is probably a stupid question but, well, I'm not all that smart...
>=20
> Instead of going through all the trouble of designing complicated digital
> filters, why don't we just pick the frequencies that we want to supress a=
nd
> replace those bins in the FFT with zeros?

You may be interested in the simple experiment using matlab.

https://poweidsplearningpath.blogspot.com/2019/04/dftidft.html
```
```On Fri, 10 Apr 2009 08:13:48 +0200, "Robert Lacoste"
<see-alciom-dot-com> wrote:

>
>"bmh161" <bmh161@yahoo.com> a &#2013265929;crit dans le message de
>news: -9CdnboVQ4Mya0DUnZ2dnUVZ_vednZ2d@giganews.com...
>> This is probably a stupid question but, well, I'm not all that smart...
>>
>> Instead of going through all the trouble of designing complicated digital
>> filters, why don't we just pick the frequencies that we want to supress
>> and
>> replace those bins in the FFT with zeros?
>>
>
>Doing what you propose (FFT of the signal, multiplying with a frequency
>mask, IFFT) gives EXACTLY the same result mathematically speaking than a FIR
>filter, its just another way to calculate it. In a nutshell :

[snipped by Lyons]

Hi Robert,
are you sure about that?  Let's say I have a
1024-sample time sequence on which I perform a 1024-pt
FFT.  Next, I zero-out the FFT bins (samples) for the
freqs I want to attenuate.  Finally I perform a 1024-pt
inverse FFT.  My resultant "filtered" time sequence
is 1024 samples in length (just as was the original
time sequence).

Now ...what kind of time-domain digital filtering can
I perform on the original 1024-sample time sequence
where the  filter output sequence is EXACTLY the same
1024 samples as the above freq-domain filtering output?
I believe the answer is: "There *IS* no such time-domain
digital filter."

As far as I know, the freq-domain filtering I discussed in
my first paragraph above is equivalent to time-domain circular
convolution, and time-domain filtering does
not perform circular convolution.

Robert, if I'm mistaken, then I'd sure like to

See Ya',
[-Rick-]

```
```On Fri, 10 Apr 2009 02:08:18 -0700 (PDT), Rune Allnor
<allnor@tele.ntnu.no> wrote:

>On 10 Apr, 02:17, Rick Lyons <R.Lyons@_BOGUS_ieee.org> wrote:
>> On Thu, 09 Apr 2009 08:22:55 -0500, "bmh161" <bmh...@yahoo.com> wrote:
>
>> >Instead of going through all the trouble of designing complicated digital
>> >filters, why don't we just pick the frequencies that we want to supress and
>> >replace those bins in the FFT with zeros?
>...
>> &#2013266080;I just wanted to say that
>> your question is sensible and that we, the DSP guys here,
>> should investigate the process of freq-domain filtering
>> in detail
>
>Rick, did we read the same post? The question is not why
>frequency domain filtering is a bad idea, but why one doesn't
>use the naive, 'obvious' specs for the filters. I commented on
>a similar question not too long ago:
>
>
>Such questions are covered in most DSP texts - I wouldn't be
>surprised if you touched on the subject already.  If not, the issue
>might be worth half a page's comments in your 3rd edition, as
>your book is the first entry point into DSP for lots of users.
>
>Teachning students how to think 'right' is an admirable (and
>difficult!) task; warning against how to think 'wrong' can only
>help the effort.
>
>Rune

Hi Rune,
Oh shoot.  Maybe I misunderstood the poster's
question.  For whatever reason, I thought he was
asking: "Can we perform an N-point FFT on an N-point
time sequence, zero-out the spectral components
that we wish to attenuate, and then perform an
N-point inverse FFT to obtain a "filtered"
time-domain sequence.

design a time-domain digital filter, then I
completely missed the point of his question.
(That wouldn't be the first time for me.)

[-Rick-]
PS. Rune, I wish you "calm seas."
```
```
glen herrmannsfeldt wrote:

> Well, say you FFT one track on a CD, maybe five minutes.
> (So not a Mahler symphony, for example.)
>
> Five minutes is 5*60*44100 samples, or 13230000 samples.
> FFT is O(N logN), so it shouldn't take all that long on most
> current machines.  The bin spacing is then 1/(5 minutes) or

FFT with the size of up to ~100M points is no problem as it takes
~minutes on PC. However beware of the numeric artifacts.

> In FFT terms, the signal is periodic.  Even if you don't believe
> that, the quantization noise will be enough that you can't
> detect frequencies closer than 0.00333Hz, anyway, in a 5 minute
> signal.

This is not so obvious to me. Can you justify that.

> Interesting question for those building 60Hz notch filters,
> how accurate is the power line frequency over short time scales?
> Is it better than 0.00333Hz?

According to my measurements, the short term accuracy of AC frequency is
about 1e-4. But the fluctiation of the waveform sets the limit to the
usefulness of the comb filters before the frequency instability comes
into play.

DSP and Mixed Signal Design Consultant
http://www.abvolt.com
```
```a@b.com wrote:
(snip, I wrote)

>>If you take the FFT on a signal that is at least as long as
>>the source, there are no in between bins.  However, FFT

> Could you give a practical numerical example, or more detail about
> what you mean here?  I guess that's different then when all
> frequencies of the sampled signal are an integer multiple of the bin
> size (so fall exactly on an FFT bin).

Well, say you FFT one track on a CD, maybe five minutes.
(So not a Mahler symphony, for example.)

Five minutes is 5*60*44100 samples, or 13230000 samples.
FFT is O(N logN), so it shouldn't take all that long on most
current machines.  The bin spacing is then 1/(5 minutes) or

In FFT terms, the signal is periodic.  Even if you don't believe
that, the quantization noise will be enough that you can't
detect frequencies closer than 0.00333Hz, anyway, in a 5 minute
signal.

Interesting question for those building 60Hz notch filters,
how accurate is the power line frequency over short time scales?
Is it better than 0.00333Hz?

-- glen
```
```On Thu, 9 Apr 2009 18:49:35 +0000 (UTC), glen herrmannsfeldt
<gah@ugcs.caltech.edu> wrote:

>Greg Berchin <gberchin@comicast.net.invalid> wrote:
>(snip on filtering using FFT)
>
>> 1. You're falling into the classic "if I just zero the appropriate FFT
>> bins, I'll have a perfect lowpass/bandpass/highpass/whateverpass
>> filter" trap.  Consider what happens in-between FFT bins -- you have
>> no control over frequencies that do not correspond to FFT bins, and
>> they will not automatically be zero just because the adjacent FFT bins
>> are zero.  If you FFT longer and longer time signals in order to be
>> able to explicitly zero more and more of those in-between frequencies,
>> eventually you will realize that you have to FFT an infinitely long
>> time signal in order to actually accomplish what you desire.
>
>If you take the FFT on a signal that is at least as long as
>the source, there are no in between bins.  However, FFT

Could you give a practical numerical example, or more detail about
what you mean here?  I guess that's different then when all
frequencies of the sampled signal are an integer multiple of the bin
size (so fall exactly on an FFT bin).
```
```On Apr 9, 9:22&#2013266080;am, "bmh161" <bmh...@yahoo.com> wrote:
> This is probably a stupid question but, well, I'm not all that smart...
>
> Instead of going through all the trouble of designing complicated digital
> filters, why don't we just pick the frequencies that we want to supress and
> replace those bins in the FFT with zeros?

Well, that's just a particular type of filter called a notch.
It's not that it doesn't work, it just has so many overused strange
side effects,
it's one of the reasons Optical Computers, Fiber Optics
Signalling,
Holograms, HDTV, CD, and DVD were invented.

```
```"hariharan.gk" <hariharan1983@yahoo.com> writes:

> I believe MIPS is also a concern when you do FFT/IFFT just for
> filtering.

MIPS are less than time-domain convolution - that's really the
reason we use it.
--
%  Randy Yates                  % "With time with what you've learned,
%% Fuquay-Varina, NC            %  they'll kiss the ground you walk
%%% 919-577-9882                %  upon."
%%%% <yates@ieee.org>           % '21st Century Man', *Time*, ELO
http://www.digitalsignallabs.com
```
```I believe MIPS is also a concern when you do FFT/IFFT just for filtering.

```
```>>This is probably a stupid question but, well, I'm not all that smart...
>>
>>Instead of going through all the trouble of designing complicated
>digital
>>filters, why don't we just pick the frequencies that we want to supress
>and
>>replace those bins in the FFT with zeros?
>>
>>
>>
>
>Then, with the undesirable frequencies zeroed out, take the inverse FFT
to
>get back to the time domain.
>

Others have already mentioned some of the problems with the method you
describe.  One approach to implementing a filter this way is to use the
window method of FIR design without ever working in the time domain.  With
the window method, the desired frequency response is plugged into the
appropriate FFT bins.  A brick wall filter would be typical (zeroing many
FFT bins).  The iFFT is then taken to create the impulse response of the
desired length and the result is then multiplied by a window function (see
Kaiser, Von Hann, Hamming, etc).  This impulse response is the coefficients