DSPRelated.com
Forums

NEWBIE confused on leakage and/or FFT bins

Started by Richard Owlett March 26, 2004
Please ignore previous posts.
I now have my own personal copy of Mr. Lyon's latest tome.
I'm algebracly challenged so Chapt 3 left me lost.

My  "REAL WORLD"  question is "How significant is leakage?"

My presuppositions:
    1. Sample TIME is constant
    2. Sample Rate is Variable

Mr. Lyons (and others ) use an application independent approach.
BUT, I'm looking at an application SPECIFIC problem.

I decided on an experimental approach.
   ( I used SCILAB as test bench )

Presume:
    1. a 100 Hz signal ( COS(2*PI*T) )
    2. a 1.000 Second sample window
    3. sample intervals of  ( .001  .001 .0001 ) mSec
    4. for t<.1 amplitude = 0

Procedure:
     do FFT of each

Expected result:
     each would have a local maximum at bin#~=10*bin# of next lower
resolution dataset

ACTUAL RESULT:
   First maximum occurred at bin 101.

I AM CONFUSED!!!





Richard Owlett wrote:

> Please ignore previous posts. > I now have my own personal copy of Mr. Lyon's latest tome. > I'm algebracly challenged so Chapt 3 left me lost. > > My "REAL WORLD" question is "How significant is leakage?" > > My presuppositions: > 1. Sample TIME is constant > 2. Sample Rate is Variable > > Mr. Lyons (and others ) use an application independent approach. > BUT, I'm looking at an application SPECIFIC problem. > > I decided on an experimental approach. > ( I used SCILAB as test bench ) > > Presume: > 1. a 100 Hz signal ( COS(2*PI*T) ) > 2. a 1.000 Second sample window > 3. sample intervals of ( .001 .001 .0001 ) mSec > 4. for t<.1 amplitude = 0 > > Procedure: > do FFT of each > > Expected result: > each would have a local maximum at bin#~=10*bin# of next lower > resolution dataset > > ACTUAL RESULT: > First maximum occurred at bin 101. > > I AM CONFUSED!!!
Before I even think about it, leakage won't be evident -- hell: there won't be any -- if the sample interval contains an integer number of cycles of each frequency present. Jerry -- 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;
Jerry Avins wrote:

> Richard Owlett wrote: > >> Please ignore previous posts. >> I now have my own personal copy of Mr. Lyon's latest tome. >> I'm algebracly challenged so Chapt 3 left me lost. >> >> My "REAL WORLD" question is "How significant is leakage?" >> >> My presuppositions: >> 1. Sample TIME is constant >> 2. Sample Rate is Variable >> >> Mr. Lyons (and others ) use an application independent approach. >> BUT, I'm looking at an application SPECIFIC problem. >> >> I decided on an experimental approach. >> ( I used SCILAB as test bench ) >> >> Presume: >> 1. a 100 Hz signal ( COS(2*PI*T) ) >> 2. a 1.000 Second sample window >> 3. sample intervals of ( .001 .001 .0001 ) mSec >> 4. for t<.1 amplitude = 0 >> >> Procedure: >> do FFT of each >> >> Expected result: >> each would have a local maximum at bin#~=10*bin# of next lower >> resolution dataset >> >> ACTUAL RESULT: >> First maximum occurred at bin 101. >> >> I AM CONFUSED!!! > > > Before I even think about it, leakage won't be evident -- hell: there > won't be any -- if the sample interval contains an integer number of > cycles of each frequency present. > > Jerry
*OOPS* *NOTE BENE* significant experimental detail. I forced the first 1/10 of sample to be = 0. [ simulating a rectangular sampling function ] My resulting FFT did resemble a sinc function.
Richard Owlett wrote:


  I decided on an experimental approach.
    ( I used SCILAB as test bench )

  Presume:
     1. a 100 Hz signal ( COS(2*PI*T) )
     2. a 1.000 Second sample window
     3. sample intervals of  ( .001  .001 .0001 ) mSec

  Procedure:
      do FFT of each

  Expected result:
      each would have a local maximum at bin#~=10*bin# of next lower
  resolution dataset

  ACTUAL RESULT:
    First maximum occurred at bin #101 for *ALL*

  I AM CONFUSED!!!

Scilab code used for this 2nd experiment


stacksize(25000000)
m3=0;,m4=0;,m5=0;
bin3=0;,bin4=0;,bin5=0;

a3=[0:.001:1]; , a4=[0:.0001:1]; ,a5=[0:.00001:1];
c3=cos(200*%pi*a3); , c4=cos(200*%pi*a4); , c5=cos(200*%pi*a5);


d3=abs(fft(c3,-1));
[m3,bin3] = max(d3(1:length(d3)/2))

d4=abs(fft(c4,-1));
[m4,bin4] = max(d4(1:length(d4)/2))

d5=abs(fft(c5,-1));
[m5,bin5] = max(d5(1:length(d4)/2))
Richard Owlett <rowlett@atlascomm.net> wrote in message news:<1069cgoonabs393@corp.supernews.com>...
 
> Presume: > 1. a 100 Hz signal ( COS(2*PI*T) ) > 2. a 1.000 Second sample window > 3. sample intervals of ( .001 .001 .0001 ) mSec > 4. for t<.1 amplitude = 0 > > Procedure: > do FFT of each > > Expected result: > each would have a local maximum at bin#~=10*bin# of next lower > resolution dataset > > ACTUAL RESULT: > First maximum occurred at bin 101. > > I AM CONFUSED!!!
So am I. I'm not sure exactly what the problem is. If your problem is that all spectra give the top of the sinc in the same bin, see below. If your problem is to understand why you see a sinc, I can't do much more than refer to Rick's book which I trust will provide an explanation (I haven't seen the 2nd edition yet, so I can't help you working your way through it). If you get a consistent sinc with maximum at bin #101 in all your experiments, I'd take a look at the signal generator. It may be a typo in your post, but I can't find the frequency in your signal generator. I think you are looking for something like x(n)=x(n*T)=cos(2*pi*f*n*dT) where f is the signal physical frequency [Hz], dT is the physical sampling period [s] and n is the sample index. In matlabese, the voodoo involved becomes %============================================================== dT=0.001; % Sampling period [s] f=100; % Physical frequency [Hz] T=1000; % Observation window [s] N=round(T/dT); % Number of samples idxv=[0:N-1]; % Time index vector x=cos(2*pi*idxv*f*dT); % Signal fv=[0:N-1]/(N*dT); % Frequecy vector plot(fv,abs(fft(x)/N)) % Plot spectrum vs frequency and % normalize spectrum for correct % amplitude figure(gcf) % Bring figure to the foreground %============================================================== CAVEAT - You may want to shorten the observation window and perhaps increase the sampling period a bit, since you get a quite long time series from the parameters you propose. Rune
Richard Owlett wrote:

> Presume: > 1. a 100 Hz signal ( COS(2*PI*T) ) > 2. a 1.000 Second sample window > 3. sample intervals of ( .001 .001 .0001 ) mSec > > Procedure: > do FFT of each > > Expected result: > each would have a local maximum at bin#~=10*bin# of next lower > resolution dataset > > ACTUAL RESULT: > First maximum occurred at bin #101 for *ALL*
Decreasing the sample interval, (increasing the rate) increases the highest frequency that can be seen. It is bin 101, if you start at 1, for 100 Hz * 1s window. -- glen
On Fri, 26 Mar 2004 16:46:13 -0600, Richard Owlett
<rowlett@atlascomm.net> wrote:

>Please ignore previous posts. >I now have my own personal copy of Mr. Lyon's latest tome. >I'm algebracly challenged so Chapt 3 left me lost. > >My "REAL WORLD" question is "How significant is leakage?" > >My presuppositions: > 1. Sample TIME is constant > 2. Sample Rate is Variable > >Mr. Lyons (and others ) use an application independent approach. >BUT, I'm looking at an application SPECIFIC problem. > >I decided on an experimental approach. > ( I used SCILAB as test bench ) > >Presume: > 1. a 100 Hz signal ( COS(2*PI*T) ) > 2. a 1.000 Second sample window > 3. sample intervals of ( .001 .001 .0001 ) mSec > 4. for t<.1 amplitude = 0 > >Procedure: > do FFT of each > >Expected result: > each would have a local maximum at bin#~=10*bin# of next lower >resolution dataset > >ACTUAL RESULT: > First maximum occurred at bin 101. > >I AM CONFUSED!!!
Hi Richard, your notation is too tough for me to understand, but here are some thoughts. Fo = 100 Hz (freq of your sinewave test signal). N = the number of time samples and the size of your DFT. Fs = sample rate in Hz. -------------------- Case 1) Fs = 1000 Hz, so N = 1000 DFT bin spacing = Fs/N = 1 Hz Your spec peak (100 Hz) should show up at the 101st bin. [The 1st DFT bin is 0 Hz.] -------------------- Case 2) Fs = 10000 Hz, so N = 10000 DFT bin spacing = Fs/N = 1 Hz Your spec peak (100 Hz) should, again, show up at the 101st bin. -------------------- Case 3) Fs = 100000 Hz, so N = 100000 DFT bin spacing = Fs/N = 1 Hz Your spec peak (100 Hz) should, again, show up at the 101st bin. Hope that helps, [-Rick-]
Rick Lyons wrote:
>[massive sinp] > DFT bin spacing = Fs/N = 1 Hz > > Your spec peak (100 Hz) should, again, > show up at the 101st bin.
"bin width = inverse of sample duration" is obvious eventually. My 1st clue was when Prof. Avins didn't reply to my second post. Then got impression "left as exercise for student" ;] YES! Jerry makes one think by not replying ;] Rick, do you now realize how strange an audience your book reaches? And to the group, *THANK YOU!*
Richard Owlett wrote:

   ...

> "bin width = inverse of sample duration" is obvious eventually. > My 1st clue was when Prof. Avins didn't reply to my second post. > Then got impression "left as exercise for student" ;] > > YES! Jerry makes one think by not replying ;]
Richard, Just so you know, I'm not weary of writing to you. (I'm also not a professional professor.) I held off because I couldn't think of a way to put it that would seem enlightening. Rick did his usual by making it immediately clear with skill that leaves me envious. This stuff is too complicated for me so just do. I have to think about what it actually means. Jerry -- 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;
On Tue, 30 Mar 2004 13:21:02 -0600, Richard Owlett
<rowlett@atlascomm.net> wrote:


Hi Richard,

I hope my previuos post helped.

>Rick Lyons wrote: >>[massive sinp] >> DFT bin spacing = Fs/N = 1 Hz >> >> Your spec peak (100 Hz) should, again, >> show up at the 101st bin. > >"bin width = inverse of sample duration" is obvious eventually.
Yep, see my Equation (3-5).
>My 1st clue was when Prof. Avins didn't reply to my second post. >Then got impression "left as exercise for student" ;] > >YES! Jerry makes one think by not replying ;] > >Rick, do you now realize how strange an audience your book reaches?
Well, you're in the situation that we have ***all*** experienced. Tryin' to understand the behavior of the DFT. It takes a while to understand the DFT, but it's *sure* worth the trouble. Good Luck, dont give up!. [-Rick-]
>And to the group, > >*THANK YOU!*