DSPRelated.com
Forums

Newbie asks "What's in a bin?"

Started by Richard Owlett February 10, 2004
I've been pointed in many helpful directions by many helpful people.
I've gotten to point of "I know I saw that answer "SOMEWHERE" ;]"

A FFT bin has a "width"   (/resolution -- is there a difference?)

Some reference I read commented on "smear" between bins when signal 
frequency was not identically equal to the center frequency of a bin.
[ Comment now if this is in error ]


Assume for sake of argument two cases for a resistive load of 1 Ohm.
1. Pure white noise source of 1 watt/hertz.
2. Pure sine wave of 10W at 1.9856789 Hz.

I can see "1" being predictable for a 10 Hz bandwidth.

What happens for an FFT for a bin width of 6 Hz centered at 4 Hz.

PS. Can someone tell me what the question I'm actually asking is?






Richard Owlett wrote:

> I've been pointed in many helpful directions by many helpful people. > I've gotten to point of "I know I saw that answer "SOMEWHERE" ;]" > > A FFT bin has a "width" (/resolution -- is there a difference?)
Nope. Crucial thing to understand here. An FFT point is a sample of a continuous function of frequency just as the time domain point is a sample of a continuous function of time.
> > Some reference I read commented on "smear" between bins when signal > frequency was not identically equal to the center frequency of a bin. > [ Comment now if this is in error ]
What happens is that when there are frequencies in the sequence being transformed that are not multiples of 1/2T then discontinuites occur at the ends which contribute across the spectrum and are a kind of smear. Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
Bob Cain wrote:
> Richard Owlett wrote: > >> I've been pointed in many helpful directions by many helpful people. >> I've gotten to point of "I know I saw that answer "SOMEWHERE" ;]" >> >> A FFT bin has a "width" (/resolution -- is there a difference?) > > > Nope. Crucial thing to understand here. An FFT point is a sample of a > continuous function of frequency just as the time domain point is a > sample of a continuous function of time. > >> >> Some reference I read commented on "smear" between bins when signal >> frequency was not identically equal to the center frequency of a bin. >> [ Comment now if this is in error ] > > > What happens is that when there are frequencies in the sequence being > transformed that are not multiples of 1/2T then discontinuites occur at > the ends which contribute across the spectrum and are a kind of smear. > > Bob
Ahhhh, you avoided my question ;{ What happens when signal frequency is *NOT* equal to center of bin?
"Richard Owlett" <rowlett@atlascomm.net> wrote in message
news:102ipt37f2arm65@corp.supernews.com...
> Bob Cain wrote: > > Richard Owlett wrote: > > > >> I've been pointed in many helpful directions by many helpful people. > >> I've gotten to point of "I know I saw that answer "SOMEWHERE" ;]" > >> > >> A FFT bin has a "width" (/resolution -- is there a difference?) > > > > > > Nope. Crucial thing to understand here. An FFT point is a sample of a > > continuous function of frequency just as the time domain point is a > > sample of a continuous function of time. > > > >> > >> Some reference I read commented on "smear" between bins when signal > >> frequency was not identically equal to the center frequency of a bin. > >> [ Comment now if this is in error ] > > > > > > What happens is that when there are frequencies in the sequence being > > transformed that are not multiples of 1/2T then discontinuites occur at > > the ends which contribute across the spectrum and are a kind of smear. > > > > Bob > > Ahhhh, you avoided my question ;{ > What happens when signal frequency is *NOT* equal to center of bin?
It gets smeared between the two bins that would otherwise be adjacent to it. ie if you have a bin centred at 4kHz and another at 6kHz and you FFT a 5kHz signal then the power from the signal will be evenly split between the 4kHz and 6kHz bins. If it was closer to 6kHz than 4kHz then the power from the signal will be primarily shown in the 6kHz bin, the 4kHz will receive less... If it's exactly 6kHz then it will entirely fall in the 6kHz bin.
Bevan Weiss wrote:

> "Richard Owlett" <rowlett@atlascomm.net> wrote in message > news:102ipt37f2arm65@corp.supernews.com... > >>Bob Cain wrote: >> >>>Richard Owlett wrote: >>> >>> >>>>I've been pointed in many helpful directions by many helpful people. >>>>I've gotten to point of "I know I saw that answer "SOMEWHERE" ;]" >>>> >>>>A FFT bin has a "width" (/resolution -- is there a difference?) >>> >>> >>>Nope. Crucial thing to understand here. An FFT point is a sample of a >>>continuous function of frequency just as the time domain point is a >>>sample of a continuous function of time. >>> >>> >>>>Some reference I read commented on "smear" between bins when signal >>>>frequency was not identically equal to the center frequency of a bin. >>>>[ Comment now if this is in error ] >>> >>> >>>What happens is that when there are frequencies in the sequence being >>>transformed that are not multiples of 1/2T then discontinuites occur at >>>the ends which contribute across the spectrum and are a kind of smear. >>> >>>Bob >> >>Ahhhh, you avoided my question ;{ >>What happens when signal frequency is *NOT* equal to center of bin? > > > It gets smeared between the two bins that would otherwise be adjacent to it. > ie if you have a bin centred at 4kHz and another at 6kHz and you FFT a 5kHz > signal then the power from the signal will be evenly split between the 4kHz > and 6kHz bins. If it was closer to 6kHz than 4kHz then the power from the > signal will be primarily shown in the 6kHz bin, the 4kHz will receive > less... > If it's exactly 6kHz then it will entirely fall in the 6kHz bin. > >
You are about right in what you will see numerically but the contents of the "bins" on either side of the signal frequency, and all others for that matter, is still a consequence of the discontinuities at the end that result from such an in-between signal and the true numerical result will be a function of the window applied. If you take the cross product of a signal at one pure frequency with that at another the result is zero. The DFT is the result of an inner product of all the discrete frequencies in the DFT with the signal itself. Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
Richard:

I think I have something useful to add here. I was involved in a project
(optical spectrum analyzer) where my job was to *exactly* determine the
center frequency of the signal, based on the FFT'd "spectrum". When the
exact frequency did not lie exactly on a bin, or even if it did, the result
was smeared due to windowing, and the fact that it did not lie exactly on a
bin.

Then, the question that I answered was, how to *exactly* recover the center
frequency of the very narrowband optical signal using the FFT results. At
first, due to input from a PhD who didn't know very much, I was told to just
take the first moment of the FFT feature. However, please note that the
"FFT" results were those from the data presented to the user, which were
after taking the sqr-root. That is, in the "magnitude" domain.

However, we discovered that there was a "sinusoidal error" that varied with
how far the true laser frequency was from a given bin. This led me to the
true answer--the way to derive exact frequency from an FFT result is to take
the first moment of the FFT bins, but in the MAGNITUDE SQUARED domain (i.e.,
raw FFT results). To do it in the magnitude domain leads to sinusoidal
error, MAX at 1/4 distance between bins, min at 1/2 and at bin centers.

So, the answer to your question is that a "bin", in the magnitude-squared
domain, represents a linearly-interpolateble sample of the energy of the
signal at that exact bin frequency.

Hope this helps,
Jim Gort

"Richard Owlett" <rowlett@atlascomm.net> wrote in message
news:102ipt37f2arm65@corp.supernews.com...
> Bob Cain wrote: > > Richard Owlett wrote: > > > >> I've been pointed in many helpful directions by many helpful people. > >> I've gotten to point of "I know I saw that answer "SOMEWHERE" ;]" > >> > >> A FFT bin has a "width" (/resolution -- is there a difference?) > > > > > > Nope. Crucial thing to understand here. An FFT point is a sample of a > > continuous function of frequency just as the time domain point is a > > sample of a continuous function of time. > > > >> > >> Some reference I read commented on "smear" between bins when signal > >> frequency was not identically equal to the center frequency of a bin. > >> [ Comment now if this is in error ] > > > > > > What happens is that when there are frequencies in the sequence being > > transformed that are not multiples of 1/2T then discontinuites occur at > > the ends which contribute across the spectrum and are a kind of smear. > > > > Bob > > Ahhhh, you avoided my question ;{ > What happens when signal frequency is *NOT* equal to center of bin? > > > > >
Richard:

I think I have something useful to add here. I was involved in a project
(optical spectrum analyzer) where my job was to *exactly* determine the
center frequency of the signal, based on the FFT'd "spectrum". When the
exact frequency did not lie exactly on a bin, or even if it did, the result
was smeared due to windowing, and the fact that it did not lie exactly on a
bin.

Then, the question that I answered was, how to *exactly* recover the center
frequency of the very narrowband optical signal using the FFT results. At
first, due to input from a PhD who didn't know very much, I was told to just
take the first moment of the FFT feature. However, please note that the
"FFT" results were those from the data presented to the user, which were
after taking the sqr-root. That is, in the "magnitude" domain.

However, we discovered that there was a "sinusoidal error" that varied with
how far the true laser frequency was from a given bin. This led me to the
true answer--the way to derive exact frequency from an FFT result is to take
the first moment of the FFT bins, but in the MAGNITUDE SQUARED domain (i.e.,
raw FFT results). To do it in the magnitude domain leads to sinusoidal
error, MAX at 1/4 distance between bins, min at 1/2 and at bin centers.

So, the answer to your question is that a "bin", in the magnitude-squared
domain, represents a linearly-interpolateble sample of the energy of the
signal at that exact bin frequency.

Hope this helps,
Jim Gort

"Richard Owlett" <rowlett@atlascomm.net> wrote in message
news:102ipt37f2arm65@corp.supernews.com...
> Bob Cain wrote: > > Richard Owlett wrote: > > > >> I've been pointed in many helpful directions by many helpful people. > >> I've gotten to point of "I know I saw that answer "SOMEWHERE" ;]" > >> > >> A FFT bin has a "width" (/resolution -- is there a difference?) > > > > > > Nope. Crucial thing to understand here. An FFT point is a sample of a > > continuous function of frequency just as the time domain point is a > > sample of a continuous function of time. > > > >> > >> Some reference I read commented on "smear" between bins when signal > >> frequency was not identically equal to the center frequency of a bin. > >> [ Comment now if this is in error ] > > > > > > What happens is that when there are frequencies in the sequence being > > transformed that are not multiples of 1/2T then discontinuites occur at > > the ends which contribute across the spectrum and are a kind of smear. > > > > Bob > > Ahhhh, you avoided my question ;{ > What happens when signal frequency is *NOT* equal to center of bin? > > > > >

Richard Owlett wrote:

> > Bob > > Ahhhh, you avoided my question ;{ > What happens when signal frequency is *NOT* equal to center of bin?
Think of it this way: when you do a DFT you are separating an N length signal into N channels each of which has a single frequency with a given magnitude and phase. Each of those frequencies has an integer number of cycles in the window of length N. If you sum all those channels you reconstruct the original signal. If your signal has the same frequency as one of those channels it will show up only in that bin (actually 2 as there is both negative and positive freq., but for real signals the negative frequencies can be ignored). If your signal is a single frequency that is not one of the component frequencies in the DFT, then it will show up in all bins. Fortunately, most of the energy will show up in the vicinity of the bin which has the closest frequency. -jim -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
jim wrote:
> > Richard Owlett wrote: > >>What happens when signal frequency is *NOT* equal to center of bin? > > > [snip] Fortunately, most of the energy will show > up in the vicinity of the bin which has the closest frequency. > >
That's what I THOUGHT I read. Solves my problem as I'll looking at how the "average" energy in a group of bins varies with time. Average in quotes as I may be able to be lazy and do arithmetic rather than RMS.
Richard Owlett <rowlett@atlascomm.net> wrote in message news:<102ikldrj3erpbc@corp.supernews.com>...
> I've been pointed in many helpful directions by many helpful people. > I've gotten to point of "I know I saw that answer "SOMEWHERE" ;]" > > A FFT bin has a "width" (/resolution -- is there a difference?)
There is a practical difference between bin width and resolution. The bin width is related to the number N of samples in the data sequence you Fourier tranform. Each bin width in the DFT is fs/N where fs is the sampling frequency. It would be very convenient if we could state that the spectrum resolution is directly related to the bin width of the DFT, but it isn't. The phenomenon is demosntrated by zero padding, i.e. when a data sequence of original lengths M is expanded by appending zeros to make up a sequence of total length N > M. If you compute the DFT of this zero padded sequence, you will find that the bin width is fs/N, but the resolution, when understood as the ability to separate different spectrum lines, is related to fs/M.
> Some reference I read commented on "smear" between bins when signal > frequency was not identically equal to the center frequency of a bin. > [ Comment now if this is in error ]
This is correct. [...]
> PS. Can someone tell me what the question I'm actually asking is?
You may find it useful to check out "spectral leakage". Rune