It's been about 10 years since I worked w/ FFT's, so I need refreshing on a couple of points. I brushed up reading Numerical Recipes and info from the Mathematica site: http://mathworld.wolfram.com/FastFourierTransform.html
Let's say I have N data points (where N is a power of 2), usually 128. To start, In Excel I'm plotting Cos(wn) where w (omega) =2 Pi / N k, n's & k's are integers 1 to 128. k is just the number of the data point and n let's me vary the frequency.
Let's say 128 data points happen in 1 second.
1) in the FFT, what are the frequencies at each interval? Point 1 is 0 hz, but what about 2, 3, ...? What freqs are those? for n=128, I get a delta at k=1 for n=64 I get a delta at k=2 for n=32 I get a delta at k=4 (don't know what happend to freqs at k=3)
2) for n=51.2, I have exactly 2.5 cycles in 128 sample points in one second. I'm sure I don't have an FFT point at exactly 51.2, so I get something that looks like an exponential series. Question is why? I still only have 1 frequency, not a range. Is this a byproduct of the FFT? How do you interpret something like that?
Let me know what points of clarification may be needed.
> It's been about 10 years since I worked w/ FFT's, so I need refreshing on a > couple of points. > I brushed up reading Numerical Recipes and info from the Mathematica site:http://mathworld.wolfram.com/FastFourierTransform.html
> Let's say I have N data points (where N is a power of 2), usually 128. To > start, In Excel I'm plotting Cos(wn) where w (omega) =2 Pi / N k, n's & k's > are integers 1 to 128. k is just the number of the data point and n let's > me vary the frequency.
> Let's say 128 data points happen in 1 second.
> 1) in the FFT, what are the frequencies at each interval? Point 1 is 0 hz, > but what about 2, 3, ...? What freqs are those? > for n=128, I get a delta at k=1 > for n=64 I get a delta at k=2 > for n=32 I get a delta at k=4 (don't know what happend to freqs at k=3)
The mapping of the FFT output bins to actual frequencies depends on the sampling rate that you use. Looking at the formula for the DFT, you can see that the k-th element of the output sequence corresponds to the DTFT evaluated at omega = 2*pi*k/N. The valid range for omega is [-pi, pi], and this range (according to the sampling theorem) corresponds to [-Fs/2, Fs/2]. So, if your sampling frequency is Fs, then the k-th element of the FFT output corresponds to Fs*k/N. Note that this relationship is only valid for the first half of the FFT output, as the second half corresponds to the "negative" frequencies in the signal; you can't get any information on spectral content above the Nyquist rate of Fs/2.
> 2) for n=51.2, I have exactly 2.5 cycles in 128 sample points in one > second. I'm sure I don't have an FFT point at exactly 51.2, so I get > something that looks like an exponential series. Question is why? I still > only have 1 frequency, not a range. Is this a byproduct of the FFT? How do > you interpret something like that?
I'm not sure exactly what you're asking here. I understand where you might expect to get a single peak in the FFT output if you input a pure sinusoid. If your sampling frequency is an integer multiple of the sinusoid's frequency, then you will see a single peak in the FFT output. This is because the "whole signal" lands in one of the frequency bins, as described above. If you have a sinusoid whose true frequency would lie between two of the FFT bins, then you get a spectral smearing effect where you see a sinc-like function in the output instead. This is an effect of having finite frequency resolution in the FFT's output. If you're doing spectral analysis on the signal, you can mitigate these effects if needed by using an appropriate window function.
If your data frame is 1 second long, then the resolution of your FFT will be 1Hz (1/frame-period). Bin0 will be the DC term, Bin1 will be 1Hz (+/-0.5Hz), Bin2 will be 2Hz (+/-0.5Hz)...etc.
Since you are probably dealing with real-only input values, you can only use half the output spectrum at most. For 128-point FFT you cannot use Bin64, as it is shared with the negative spectrum, so bin63 (your highest bin) will contain 63Hz(+/-0.5Hz)
A point worth remembering is that, regardless of the FFT point-size, or sampling frequency, when a signal is dead-centre with a bin, there will be exactly the bin-index number of cycles in the input frame (less one sample). So, for example, if you had a frequency dead in the middle of Bin37, there would be exactly 37cycles (-1 sample) in the input frame. So, from this you can see that the index number of the bin-scale is Frequency, whose dimension is Cycles/Frame. To convert to Cycles/Sec, just multiply by Frames/Sec or SampleRate/FFTsize.
> It's been about 10 years since I worked w/ FFT's, so I need refreshing on a > couple of points. > I brushed up reading Numerical Recipes and info from the Mathematica site:http://mathworld.wolfram.com/FastFourierTransform.html
> Let's say I have N data points (where N is a power of 2), usually 128. To > start, In Excel I'm plotting Cos(wn) where w (omega) =2 Pi / N k, n's & k's > are integers 1 to 128. k is just the number of the data point and n let's > me vary the frequency.
> Let's say 128 data points happen in 1 second.
> 1) in the FFT, what are the frequencies at each interval? Point 1 is 0 hz, > but what about 2, 3, ...? What freqs are those? > for n=128, I get a delta at k=1 > for n=64 I get a delta at k=2 > for n=32 I get a delta at k=4 > (don't know what happend to freqs at k=3)
The "freqs" for k=3 require n= (128 / 3), so what happened to them is that you skipped a divisor.
> 2) for n=51.2, I have exactly 2.5 cycles in 128 sample points in one > second. I'm sure I don't have an FFT point at exactly 51.2, so I get > something that looks like an exponential series. Question is why? I still > only have 1 frequency, not a range.
Nope. You have 1 frequency only if you FFT it for a whole number of cycles of your sinusoid. But you chopped it up using the FFT's inherent window of n = 128 that is not a whole number of cycles of your sinusoid, so you ended up with the frequency not of just your sinusoid, but of your windowed sinusoidal fragment, which is a sinc function in the complex FFT domain, convolved with your desired delta.
(If the window chops your sinusoid into an integer number of cycles, then the sinc function is centered on a bin, which just happens to be invisible to all other integer bins).
> Is this a byproduct of the FFT? How do > you interpret something like that?
Some say it is a byproduct of the FFT being circular, I prefer to think of it as a byproduct of your chopping your signal short to fit it inside your FFT's time domain vector.
Ron N. wrote: > On Feb 26, 4:50 pm, "Jay Wolfe" <jayw...@adelphia.net> wrote: >> Hi,
>> It's been about 10 years since I worked w/ FFT's, so I need refreshing on a >> couple of points. >> I brushed up reading Numerical Recipes and info from the Mathematica site:http://mathworld.wolfram.com/FastFourierTransform.html
>> Let's say I have N data points (where N is a power of 2), usually 128. To >> start, In Excel I'm plotting Cos(wn) where w (omega) =2 Pi / N k, n's & k's >> are integers 1 to 128. k is just the number of the data point and n let's >> me vary the frequency.
>> Let's say 128 data points happen in 1 second.
>> 1) in the FFT, what are the frequencies at each interval? Point 1 is 0 hz, >> but what about 2, 3, ...? What freqs are those? >> for n=128, I get a delta at k=1 >> for n=64 I get a delta at k=2 >> for n=32 I get a delta at k=4 >> (don't know what happend to freqs at k=3)
> The "freqs" for k=3 require n= (128 / 3), so what happened to > them is that you skipped a divisor.
>> 2) for n=51.2, I have exactly 2.5 cycles in 128 sample points in one >> second. I'm sure I don't have an FFT point at exactly 51.2, so I get >> something that looks like an exponential series. Question is why? I still >> only have 1 frequency, not a range.
> Nope. You have 1 frequency only if you FFT it for a whole > number of cycles of your sinusoid. But you chopped it up > using the FFT's inherent window of n = 128 that is not a whole > number of cycles of your sinusoid, so you ended up with the > frequency not of just your sinusoid, but of your windowed > sinusoidal fragment, which is a sinc function in the complex > FFT domain, convolved with your desired delta.
> (If the window chops your sinusoid into an integer number > of cycles, then the sinc function is centered on a bin, which > just happens to be invisible to all other integer bins).
>> Is this a byproduct of the FFT? How do >> you interpret something like that?
> Some say it is a byproduct of the FFT being circular, > I prefer to think of it as a byproduct of your chopping > your signal short to fit it inside your FFT's time domain > vector.
By the way: people use tapered windows to reduce the offending effect. As always in life, every solution id=s the cause of another problem.
Jerry -- Engineering is the art of making what you want from things you can get. ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
> Ron N. wrote: >> On Feb 26, 4:50 pm, "Jay Wolfe" <jayw...@adelphia.net> wrote: >>> Hi,
>>> It's been about 10 years since I worked w/ FFT's, so I need refreshing >>> on a >>> couple of points. >>> I brushed up reading Numerical Recipes and info from the Mathematica >>> site:http://mathworld.wolfram.com/FastFourierTransform.html
>>> Let's say I have N data points (where N is a power of 2), usually 128. >>> To >>> start, In Excel I'm plotting Cos(wn) where w (omega) =2 Pi / N k, n's & >>> k's >>> are integers 1 to 128. k is just the number of the data point and n >>> let's >>> me vary the frequency.
>>> Let's say 128 data points happen in 1 second.
>>> 1) in the FFT, what are the frequencies at each interval? Point 1 is 0 >>> hz, >>> but what about 2, 3, ...? What freqs are those? >>> for n=128, I get a delta at k=1 >>> for n=64 I get a delta at k=2 >>> for n=32 I get a delta at k=4 >>> (don't know what happend to freqs at k=3)
>> The "freqs" for k=3 require n= (128 / 3), so what happened to >> them is that you skipped a divisor.
>>> 2) for n=51.2, I have exactly 2.5 cycles in 128 sample points in one >>> second. I'm sure I don't have an FFT point at exactly 51.2, so I get >>> something that looks like an exponential series. Question is why? I >>> still >>> only have 1 frequency, not a range.
>> Nope. You have 1 frequency only if you FFT it for a whole >> number of cycles of your sinusoid. But you chopped it up >> using the FFT's inherent window of n = 128 that is not a whole >> number of cycles of your sinusoid, so you ended up with the >> frequency not of just your sinusoid, but of your windowed >> sinusoidal fragment, which is a sinc function in the complex >> FFT domain, convolved with your desired delta.
>> (If the window chops your sinusoid into an integer number >> of cycles, then the sinc function is centered on a bin, which >> just happens to be invisible to all other integer bins).
>>> Is this a byproduct of the FFT? How do >>> you interpret something like that?
>> Some say it is a byproduct of the FFT being circular, >> I prefer to think of it as a byproduct of your chopping >> your signal short to fit it inside your FFT's time domain >> vector.
> By the way: people use tapered windows to reduce the offending effect. As > always in life, every solution id=s the cause of another problem.
> Jerry > -- > Engineering is the art of making what you want from things you can get. > ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ