DSPRelated.com
Forums

FFT Questions - Zero Hz

Started by Unknown November 6, 2006
1) I have run a FFT (using Matlab) on several different data types and
noticed that I always have a high peak at 0Hz (when plotted against
frequency on the x-axis).  I do not have a math or engineering
background, but was trying to read as Signal Processing book by Lyons
and was having a little trouble understanding.  The book mentioned that
the 0Hz was the "DC" value?  What does that mean?  I don't really know
what 0Hz would be (i.e. does not exit)?  Does anyone know how to
explain this in simple terms?

2) I notice when I choose to break up my FFT into say 1024 points and
then again 2048 points that my frequency is now also broken up into
more points (the 2048 has better resolution).  Is this correct?
Shouldn't the same data always have the same frequencies?

1) I have run a FFT (using Matlab) on several different data types and
noticed that I always have a high peak at 0Hz (when plotted against
frequency on the x-axis).  I do not have a math or engineering
background, but was trying to read as Signal Processing book by Lyons
and was having a little trouble understanding.  The book mentioned that
the 0Hz was the "DC" value?  What does that mean?  I don't really know
what 0Hz would be (i.e. does not exit)?  Does anyone know how to
explain this in simple terms?

2) I notice when I choose to break up my FFT into say 1024 points and
then again 2048 points that my frequency is now also broken up into
more points (the 2048 has better resolution).  Is this correct?
Shouldn't the same data always have the same frequencies?

On 6 Nov 2006 10:45:51 -0800, "ms" <silvertonm@gmail.com> wrote:

>> The 0 frequency term is just the average value of all the samples. Normally, >> AC-coupled signals have a zero average value. But if your input values are not >> centered around 0, then you will get a very large value in the 0 frequency bin >> in the FFT. > >Thank you for the response. > >I have a follow up question. I am not looking at AC-type signals >(movement of an arm in space) so I wouldn't expect the "average value" >to equal zero. I would like to filter the data and that is why I am >using the FFT. If I want to look at the relative power of each >frequency should I take out the zero frequency value and evaluate the >remaining frequency?
Ignoring the 0 bin should be equivalent to pre-filtering the data to remove the DC bias. But are you really interested is ALL the other frequency bins anyway? What about bin 1? The value in that bin is of questionable value, given the sampling window effects. Are you using any sort of filter to reduce the start and stop transients? There are various windowing functions that are sometimes applied. They mostly affect the results in the lower frequency bins. Robert Scott Ypsilanti, Michigan
> The 0 frequency term is just the average value of all the samples. Normally, > AC-coupled signals have a zero average value. But if your input values are not > centered around 0, then you will get a very large value in the 0 frequency bin > in the FFT.
Thank you for the response. I have a follow up question. I am not looking at AC-type signals (movement of an arm in space) so I wouldn't expect the "average value" to equal zero. I would like to filter the data and that is why I am using the FFT. If I want to look at the relative power of each frequency should I take out the zero frequency value and evaluate the remaining frequency?
ms wrote:

>>The 0 frequency term is just the average value of all the samples. Normally, >>AC-coupled signals have a zero average value. But if your input values are not >>centered around 0, then you will get a very large value in the 0 frequency bin >>in the FFT. > > > Thank you for the response. > > I have a follow up question. I am not looking at AC-type signals > (movement of an arm in space) so I wouldn't expect the "average value" > to equal zero. I would like to filter the data and that is why I am > using the FFT. If I want to look at the relative power of each > frequency should I take out the zero frequency value and evaluate the > remaining frequency? >
"That depends", says the chorus. The FFT is only exact if you are analyzing a signal that is periodic, with a period exactly equal to the length of your sample. Most real world problems _aren't_ periodic, so the FFT is an approximation of what you really want. Because the FFT thinks* it's looking at one cycle of periodic data, any mismatch between the beginning and end of the data looks to the FFT like a real jump in the data, and it'll give answers consistent with that jump. The answer to this is windowing (Lyon's book should mention this, as will about a gazillion web pages). However, windowing data spreads the frequency data a bit, and a bit of spreading on a huge signal will make it spill all over all of it's neighbors. Since your 0Hz signal is huge compared to the rest of the data, it'll stomp on the actual signals you want to see. So the normal procedure to use when analyzing data with an FFT is to do the following: * Remove the DC by averaging the data and subtracting out the mean. * Sometimes you'll need to fit a trend line to the data and subtract that out as well -- use your judgment. * Window what's left**. * Do the FFT. * Plug back in the DC value, if that floats your boat. * Look at the result. * Yes, I know the FFT doesn't think. But sometimes anthropomorphizing helps, OK? ** Which window to use is an entirely different subject, and there are lots of them to choose from. Almost any window is better than none for most problems, so just picking one and running with it should work for you at first. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Hi from a fellow NEWBIE, but with an engineering orientation.
[I'm a 'newbie' even if one elder of group states otherwise ;]


silvertonm@gmail.com wrote:

> 1) I have run a FFT (using Matlab) on several different data types
^^^^^^^^^^ ? What do *YOU* mean by "data types"? I suggest a brief description of your problem/environment. [Once, as an instrumentation technician in a RESEARCH CHEMISTRY LAB, I *VAINLY* tried to explain to a PHD chemist that it was silly to specify being able to specify ability to measure TENTHS of *one* electron/second. I've gut feel you are falling into similar trap.
> and > noticed that I always have a high peak at 0Hz (when plotted against > frequency on the x-axis). I do not have a math or engineering > background, but was trying to read as Signal Processing book by Lyons > and was having a little trouble understanding. The book mentioned that > the 0Hz was the "DC" value? What does that mean? I don't really know > what 0Hz would be (i.e. does not exit)? Does anyone know how to > explain this in simple terms?
What it means depends HEAVILY on what you are trying to do.
> > 2) I notice when I choose to break up my FFT into say 1024 points and > then again 2048 points that my frequency is now also broken up into > more points (the 2048 has better resolution). Is this correct? > Shouldn't the same data always have the same frequencies? >
That has been covered in the answers you have already received. If any of the above does not make sense, post more questions. This group is friendly/helpful/supportive of those who try. IMHO YOU PASS
ms wrote:
> > The 0 frequency term is just the average value of all the samples. Normally, > > AC-coupled signals have a zero average value.
This is only true if the signal is sufficiently close to bandlimited. Otherwise the AC-coupled signal could still also include the value of certain aliased frequency components (n*Fs/2) within the average value of all the samples.
> But if your input values are not > > centered around 0, then you will get a very large value in the 0 frequency bin > > in the FFT. > > Thank you for the response. > > I have a follow up question. I am not looking at AC-type signals > (movement of an arm in space) so I wouldn't expect the "average value" > to equal zero. I would like to filter the data and that is why I am > using the FFT. If I want to look at the relative power of each > frequency should I take out the zero frequency value and evaluate the > remaining frequency?
Note any frequency component whose period is not an exact submultiple of the FFT length will appear in multiple bins, depending on the window used, including the zero-th bin. So if you take out the so-called "DC" bin, you also potentially remove information about other very low frequency content. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
Thank you for the response.  I really appreciate it and am glad to hear
this is a friendly group!  I noticed in the beginning of Lyons' book
that he mentioned the people of this are great.  I have already
recieved a lot of good info.

I do, however, still have some questions.  Please let me explain my
problem:

I am collecting several different variables (EMG, arm motion, and
force) during an experiment of an arm moving in space.  A light is
triggered, and the person is asked to punch a device that measures
force.  I am trying to determine what the appropriate cutoff frequency
is to use on the 3 different data values (I would think all would be
different frequencies).  I have looked in the scientific literature and
have seen varying reports (as expected as everyone uses different
equipment).  In the example of arm motion, I have a point on the hand
that I can trace the trajectory as a function of time.  The sampling
rate is 100Hz.

In any case, I have a very large amplitude of the values at 0Hz (for
all variables, not just arm motion...but I thought I would start with
arm motion first).  To me, I can't really understand the concept of 0Hz
(frequency does not exist).  So, I was wondering why there is such a
large value there.  From previous responses in this listing, this 0Hz
is the mean value of the entire signal (since the motion is not really
a sine wave type of movement...it is really pretty linear).  If the
signal was a sine wave, then the 0Hz (is this the same thing as the
first window/bin?) is 'eliminated'.  That is, I created a sine-wave and
ran an FFT on it and there was only a spike at the corresponding
frequency...no spike at 0Hz.

Thank you







Richard Owlett wrote:
> Hi from a fellow NEWBIE, but with an engineering orientation. > [I'm a 'newbie' even if one elder of group states otherwise ;] > > > silvertonm@gmail.com wrote: > > > 1) I have run a FFT (using Matlab) on several different data types > ^^^^^^^^^^ ? > What do *YOU* mean by "data types"? > I suggest a brief description of your problem/environment. > > [Once, as an instrumentation technician in a RESEARCH CHEMISTRY LAB, I > *VAINLY* tried to explain to a PHD chemist that it was silly to specify > being able to specify ability to measure TENTHS of *one* electron/second. > > I've gut feel you are falling into similar trap. > > > and > > noticed that I always have a high peak at 0Hz (when plotted against > > frequency on the x-axis). I do not have a math or engineering > > background, but was trying to read as Signal Processing book by Lyons > > and was having a little trouble understanding. The book mentioned that > > the 0Hz was the "DC" value? What does that mean? I don't really know > > what 0Hz would be (i.e. does not exit)? Does anyone know how to > > explain this in simple terms? > > What it means depends HEAVILY on what you are trying to do. > > > > > 2) I notice when I choose to break up my FFT into say 1024 points and > > then again 2048 points that my frequency is now also broken up into > > more points (the 2048 has better resolution). Is this correct? > > Shouldn't the same data always have the same frequencies? > > > > That has been covered in the answers you have already received. > > If any of the above does not make sense, post more questions. > > This group is friendly/helpful/supportive of those who try. > IMHO YOU PASS
I did the analysis as suggested in this sequence.

1)Removed the DC by averaging the data and subtracting out the mean. (I
also just artifically made the first value of the fft data equal to
zero (after the fft was performed on the data) and found the exact same
frequency distribution).
>*** Window what's left**. (WHAT DOES THIS MEAN?)
2)Performed the FFT (N-point FFT that was equal to the length of the data). 3)Looked at the result (This looked a lot more similar to what you seen in textbooks for motion data).
> ** Which window to use is an entirely different subject, and there > are lots of them to choose from. Almost any window is better than > none for most problems, so just picking one and running with it > should work for you at first.
What does windowing mean? Is this the number of points of the FFT?
Robert Scott wrote:

> Ignoring the 0 bin should be equivalent to pre-filtering the data to remove the > DC bias. But are you really interested is ALL the other frequency bins anyway? > What about bin 1? The value in that bin is of questionable value, given the > sampling window effects. Are you using any sort of filter to reduce the start > and stop transients? There are various windowing functions that are sometimes > applied. They mostly affect the results in the lower frequency bins.
Could you please clarify what "bins" represent? Would this be the frequency bins? For example, I am performing the FFT and plotting the results against frequency. Would bin 1 equal the value at 1Hz frequency or the first value after the 0Hz frequency? Sorry for such a basic question.