MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Attach frequency list to a list of fourier tranformed numbers

Hi, Raymond

Your question:
How do I attach the actual frequency values to a list of numbers
transformed using the Fourier[list] command?

My answer:

Here's  what I do.
Actually the answer depends on what the initial data mean. Let's suppose
we're in time domain, and that you have sampled a waveform over an
interval T with sampling time Ts, that is you have the values at t=
0,Ts,2Ts,...,kTs,..(n-1)Ts. (henceTs=T/n) The frequencies associated
are f=1/T and fmax=1/Ts. Your Fourier transformed data will span an
interval fmax wide with step f. But, beware!, your spectrum is folded,
so you will go with the "real" values from frequency 0 to frequency
fnyq=fmax/2 and from then on (fnyq to fmax) you'll have a folded copy
of the first part.
To associate the frequencies to the spectrum we need to know either the
sampling time Ts or the interval duration T, but let's start with the
continuous signal of frquency 2 Hz

    f[t_]:=Sin[ 2Pi 2t ]
    data=Table[ { t , f[t]+0.Random[Real,{-.5,.5}]},   {t,0,5,5/255} ];
(incidentally, powers of two are what Fourier crunching motors do

Let's scorporate time values from signal values

    trange=#[[1]]&/@data; signal=#[[2]]&/@data;

the interval duration and the sampling interval are

    T=(Max[trange]-Min[trange])// N ; Ts=T/Length[trange//N ;

frequency will vary from 0 to 1/Ts in 256 steps 1/T wide


Now we calculate the Fourier transform of the 256 point data


and finally we put the frequency data together


Try this to see that indeed your spectrum shows two peaks at 2Hz and at
49.2 (that is 51.2-2) Hx.
The value at 51.2 is 1/Ts, while 2 is the frequency of the sinusoid we
used to build our data set



In case you prefer it you can even unfold your spectrum so to show the
components at negative frequencies, spanning from -fnyq to +fnyq. But
at this point it's quite straightforward.

What worries me is that to do this in general, *I think*, you'll have to
discern between the case with an even number of points and an odd
number, and worst still you need to know wether frequency 0 is
comprised in the data set or not (-1,0,1,...  or -1.5,-0.5,0.5,1.5,..).
So I, too, have a question for the newsgroup: is there a simple and
straigthforward method to unfold the spectrum regardless of this

Hope that helps.

  • Prev by Date: Re: Differentiation ?
  • Next by Date: Re: Single character in Italics. Ervin Doyle;
  • Previous by thread: Attach frequency list to a list of fourier tranformed numbers
  • Next by thread: Re: Attach frequency list to a list of fourier tranformed numbers