# Frequency resolution of FFT after windowing

Started by July 26, 2006
```When I normally do a FFT, the frequency resolution = sampling
frequency/number of samples.

When I use windowing (like BH4) to prevent smearing, this should increase
the frequency resolution of the FFT, because of the convolution in the
frequency domain.  I have seen tables which show the frequency resolution
increases by a factor of 1.9 for a Blackman Harris window, so if the
frequency resolution was 100 Hz without windowing, it should now be ~190
Hz.

1) How can I calculate what this factor is, or what the new frequency
resolution is?

2) I can only do FFTs when the number of samples is a power of 2.  So if I
assume the 1.9 is correct, should I capture 1.9 x samples, and then
decimate by a factor of 1.9 (i.e. throw away 47% of the samples)?  Is this
the best or simplest way to obtain the correct spectrum?

Can anyone refer me to a book or article which explains this?

```
```"spaz" <cmas@earthlink.net> wrote in message
news:rpWdnVXmcNMK9VrZnZ2dnUVZ_vKdnZ2d@giganews.com...
> When I normally do a FFT, the frequency resolution = sampling
> frequency/number of samples.
>
> When I use windowing (like BH4) to prevent smearing, this should increase
> the frequency resolution of the FFT, because of the convolution in the
> frequency domain.  I have seen tables which show the frequency resolution
> increases by a factor of 1.9 for a Blackman Harris window, so if the
> frequency resolution was 100 Hz without windowing, it should now be ~190
> Hz.
>
> 1) How can I calculate what this factor is, or what the new frequency
> resolution is?
>
> 2) I can only do FFTs when the number of samples is a power of 2.  So if I
> assume the 1.9 is correct, should I capture 1.9 x samples, and then
> decimate by a factor of 1.9 (i.e. throw away 47% of the samples)?  Is this
> the best or simplest way to obtain the correct spectrum?
>
> Can anyone refer me to a book or article which explains this?

It's easy to confuse sampling interval with resolution because the sample
interval splits or "resolves" the signal into discrete points.
However, the actual resolution is something else.

How to determine?

Compute the *continuous* Fourier Transform of the window you're using.
If there's "no window" i.e. a continuous rectangular window then the FT will
be a sinc and you can ponder what resolution is implied by a sinc.
If there's some other continuous window then you do the same thing.

Now, if the data is time-sampled and you use the FFT then the frequency
domain will be sampled and the underlying shape that you get above is
obscured - but it's still there.
Try doing an FFT of a sinusoid with exactly K+0.5 cycles in time.  You will
see all the peaks of the sinc if the window is rectangular.

No need to interpolate or decimate in this regard.  But, there may be other
reasons.

There is no "correct" spectrum *or* every spectrum that you compute is
"correct" depending on how you view what you're doing and the associated
math...

Fred

```
```> Can anyone refer me to a book or article which explains this?

Chris
=================
Chris Bore
BORES Signal Processing

spaz wrote:
> When I normally do a FFT, the frequency resolution = sampling
> frequency/number of samples.
>
> When I use windowing (like BH4) to prevent smearing, this should increase
> the frequency resolution of the FFT, because of the convolution in the
> frequency domain.  I have seen tables which show the frequency resolution
> increases by a factor of 1.9 for a Blackman Harris window, so if the
> frequency resolution was 100 Hz without windowing, it should now be ~190
> Hz.
>
> 1) How can I calculate what this factor is, or what the new frequency
> resolution is?
>
> 2) I can only do FFTs when the number of samples is a power of 2.  So if I
> assume the 1.9 is correct, should I capture 1.9 x samples, and then
> decimate by a factor of 1.9 (i.e. throw away 47% of the samples)?  Is this
> the best or simplest way to obtain the correct spectrum?
>
> Can anyone refer me to a book or article which explains this?

```
```There have been some great explanations so far but I would like to
simplfiy the problem even further.

Basic concepts:
1) Multiplication in the time domain is convolution in the frequency
domain
2) Multiplication in the frequency domain is convolution in the time
domain (thats how digital filters work).
3) Shaping windows have impulse responses:
a) The FFT has a built in box car impulse response which is a sinc
function in the frequency domain. if your waveform is not continus at
the edges of the FFT there will be impulse noise resembling a sinc
function.
b) Various windows can reduce the noise caused by edge
discontinuities.

You can easily run an experiment by trying various impulse responses of
windows and then FFT them.

I have uses a squared Hanning window which gave me more than 100 db of
rejection.

Michael

```
```"spaz" <cmas@earthlink.net> wrote in message
> When I normally do a FFT, the frequency resolution = sampling
> frequency/number of samples.
>
> When I use windowing (like BH4) to prevent smearing, this should increase
> the frequency resolution of the FFT, because of the convolution in the
> frequency domain.  I have seen tables which show the frequency resolution
> increases by a factor of 1.9 for a Blackman Harris window, so if the
> frequency resolution was 100 Hz without windowing, it should now be ~190
> Hz.

You prevent smearing or  you reduce leakage , but I would say you
definitely do not increase the frequency resolution.
And how is a frequency resolution of 190 Hz better than 100 Hz?
How do you interpret those numbers?
I don't know where the 1.9 you saw comes from but it is probably
some number about the side-lobe reduction.

> 1) How can I calculate what this factor is, or what the new frequency
> resolution is?

If your fft is taken over N points, you will have bins that are spaced
in a distance of SR/N Hz (SR=samplerate).  So if your first component
(after DC) is at 100Hz you have 100,200,300.. and so on.  So the smaller
the intervall between the bins, the better is your frequency resolution.
Windowing does not change the resolution.

>
> 2) I can only do FFTs when the number of samples is a power of 2.

No, there are algorithms to do FFTs for any number of samples.

> So if I
> assume the 1.9 is correct, should I capture 1.9 x samples, and then
> decimate by a factor of 1.9 (i.e. throw away 47% of the samples)?  Is this
> the best or simplest way to obtain the correct spectrum?

I don't really understand. What exactly do you want to achieve?

> Can anyone refer me to a book or article which explains this?

http://ccrma.stanford.edu/~jos/mdft/

gr.
Anton
```
```Anton wrote:
> "spaz" <cmas@earthlink.net> wrote in message
>  snip
>>Can anyone refer me to a book or article which explains this?
>
>
> http://ccrma.stanford.edu/~jos/mdft/
>

Not sure if that's what OP desired.
BUT, I think I'll find link useful.
Thank you.

[Even if I attended Cornell ;]
```
```spaz wrote:
> When I normally do a FFT, the frequency resolution = sampling
> frequency/number of samples.
>
> When I use windowing (like BH4) to prevent smearing, this should increase
> the frequency resolution of the FFT, because of the convolution in the
> frequency domain.  I have seen tables which show the frequency resolution
> increases by a factor of 1.9 for a Blackman Harris window, so if the
> frequency resolution was 100 Hz without windowing, it should now be ~190
> Hz.
>
> 1) How can I calculate what this factor is, or what the new frequency
> resolution is?
>
> 2) I can only do FFTs when the number of samples is a power of 2.  So if I
> assume the 1.9 is correct, should I capture 1.9 x samples, and then
> decimate by a factor of 1.9 (i.e. throw away 47% of the samples)?  Is this
> the best or simplest way to obtain the correct spectrum?

If I understand what you are asking, your questions are based on more
than one misconception. For examples, windows don't alter frequency
resolution /per se/, and the smaller the frequency range, the better the
resolution (so 100 Hz in nearly twice as fine as 190 Hz).

> Can anyone refer me to a book or article which explains this?

http://www.bores.com/courses/intro/basics/index.htm
http://dspguide.com/

Jrry
--
Engineering is the art of making what you want from things you can get.
&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
```
```Hi Spaz,

Maybe I was a bit unconcentrated when I replied.

Anton <berlach@koncon.nl> writes:

> "spaz" <cmas@earthlink.net> wrote in message
....
>>
>> When I use windowing (like BH4) to prevent smearing, this should increase
>> the frequency resolution of the FFT, because of the convolution in the
>> frequency domain.  I have seen tables which show the frequency resolution
>> increases by a factor of 1.9 for a Blackman Harris window, so if the
>> frequency resolution was 100 Hz without windowing, it should now be ~190
>> Hz.
>
> You prevent smearing or  you reduce leakage , but I would say you
> definitely do not increase the frequency resolution.
> And how is a frequency resolution of 190 Hz better than 100 Hz?
> How do you interpret those numbers?
> I don't know where the 1.9 you saw comes from but it is probably
> some number about the side-lobe reduction.

Windowing could change the resolution.  I just don't think that
it is important if you use a von Hann or Blackman Harris or
rectangular window.  However if you put a window with half the
size of the buffer over the signal, you have the same situation
as if you take an fft of half the size with zero padding.
So you would see a sampling intervall of SR/N but every second
(frequency) sample is just the result of a sinc interpolation and
the information containted is just as much as you can get from
the non-zero part of the window.

And for the part where I asked you how 190Hz would be better
you did not say.

gr.
Anton
```
```Hi,

spaz schrieb:
> When I normally do a FFT, the frequency resolution = sampling
> frequency/number of samples.
>
> When I use windowing (like BH4) to prevent smearing, this should increase
> the frequency resolution of the FFT, because of the convolution in the
> frequency domain.  I have seen tables which show the frequency resolution
> increases by a factor of 1.9 for a Blackman Harris window, so if the
> frequency resolution was 100 Hz without windowing, it should now be ~190
> Hz.

Well, something like that...

Look at http://en.wikipedia.org/wiki/Window_function

There are many common window functions with the corresponding B factor.

> 1) How can I calculate what this factor is, or what the new frequency
> resolution is?

Do an FFT from the window function sufficiently padded with zeros. E.g.
calculate the window function for 1024 samples and pad it with 3072
zeros. The absolute values of the FFT coefficients is the frequency
response of the window function. Look where it croses the -3dB line
compared to the rectangular window.

I have done this for several window functions, removing the fine
structure at higher frequencies. It looks like
in future)

> 2) I can only do FFTs when the number of samples is a power of 2.  So if I
> assume the 1.9 is correct, should I capture 1.9 x samples, and then
> decimate by a factor of 1.9 (i.e. throw away 47% of the samples)?  Is this
> the best or simplest way to obtain the correct spectrum?

Use 2 x as much samples.

Marcel
```
```>
>news:rpWdnVXmcNMK9VrZnZ2dnUVZ_vKdnZ2d@giganews.com...
>> When I normally do a FFT, the frequency resolution = sampling
>> frequency/number of samples.
>>
>> When I use windowing (like BH4) to prevent smearing, this should
increase
>> the frequency resolution of the FFT, because of the convolution in the
>> frequency domain.  I have seen tables which show the frequency
resolution
>> increases by a factor of 1.9 for a Blackman Harris window, so if the
>> frequency resolution was 100 Hz without windowing, it should now be
~190
>> Hz.
>>
>> 1) How can I calculate what this factor is, or what the new frequency
>> resolution is?
>>
>> 2) I can only do FFTs when the number of samples is a power of 2.  So
if I
>> assume the 1.9 is correct, should I capture 1.9 x samples, and then
>> decimate by a factor of 1.9 (i.e. throw away 47% of the samples)?  Is
this
>> the best or simplest way to obtain the correct spectrum?
>>
>> Can anyone refer me to a book or article which explains this?
>
>It's easy to confuse sampling interval with resolution because the sample

>interval splits or "resolves" the signal into discrete points.
>However, the actual resolution is something else.
>
>How to determine?
>
>Compute the *continuous* Fourier Transform of the window you're using.
>If there's "no window" i.e. a continuous rectangular window then the FT
will
>be a sinc and you can ponder what resolution is implied by a sinc.
>If there's some other continuous window then you do the same thing.
>
>Now, if the data is time-sampled and you use the FFT then the frequency
>domain will be sampled and the underlying shape that you get above is
>obscured - but it's still there.
>Try doing an FFT of a sinusoid with exactly K+0.5 cycles in time.  You
will
>see all the peaks of the sinc if the window is rectangular.
>
>No need to interpolate or decimate in this regard.  But, there may be
other
>reasons.
>
>There is no "correct" spectrum *or* every spectrum that you compute is
>"correct" depending on how you view what you're doing and the associated

>math...
>
>Fred
>
>
>
I guess I am confused.  The frequency resolution I'm trying to get at is
the difference between two adjacent bins in the spectrum.  I have heard
this also called the Fourier frequency.

Suppose I have a signal at 1 MHz and another one at 1.024 kHz.  If
everything is coherent, and I sample at 8.192 MHz, capture time domain
data with 1024 samples, fft, and then look at the spectrum, I have 512
bins.  Each one represents fres = fs/ns = 8 kHz, and see two signals which
I can easily resolve. There's one in bin #125 and one in bin #128. That's
what I call a correct spectrum.

If I do the same thing, but window before the fft, and then look at the
spectrum, I still have 512 bins.  But each bin does not represent 8 kHz,
because I messed with the time domain data before the fft.  The signals
are still there in the frequency domain, but they are too close to each
other to easily resolve.  So I think either this spectrum should either be
plotted with fewer bins or I have to to something else, like capture more
samples.

```