DSPRelated.com
Forums

practical FFT

Started by Sharan123 January 1, 2016
>For the length-N input vector and the natural ordering of the FFT >outputs (i.e., using the index definitions for general transforms), >each output bin is the correlation of the input with a sinusoid of k >cycles per N samples, where k is the index of the bin. In other >words, bin 1 will contain the cross-correlation of the input and a >(complex) sinusoid with exactly 1 cycle per N samples. Bin 2 will >correlate against 2 cycles/N samples, etc. Bin 0 has the DC energy, >and bin -1 (folded about DC, or bin N-1), has the cross-correlation of >the input against a (complex) sinusoid of 1 cycle/N samples rotating >in the opposite direction of that used for bin 1.
Dear Eric, With respect to the above algorithm, would there be a change in outputs if multiple cycles for a given frequency at the input are present? The example I have tried does give accurate results but I just want to your comments ... --------------------------------------- Posted through http://www.DSPRelated.com
>>If you have a pure sinusoidal, with an integer number of cycles within >>your frame, only the nth bin will be non-zero. > >Dear Cedron, > >I am going through your blog on DFT. I will come back with questions >specific to that ... > >with respect to your comment above, when a natural signal is sampled
where
>only the frequency range is possibly known, it is rather difficult to >ensure "integer number of cycles". Integer number of cycles could also
be
>not possible if relative frequencies are not integer multiples ... > >Maybe, I am misinterpreting your comment above ... > >--------------------------------------- >Posted through http://www.DSPRelated.com
Most of the time when you are sampling real world signals, the frequency will not be an integer multiple of your frame size nor will the tone be a simple sinusoidal. A repeated waveform can be represented by a sum of sinusoidals which is the crux of Fourier analysis. In this case, the higher pitched tones will be harmonics of the base frequency. When you have a pure integer frequency tone, you can tell the frequency by the bin number. When you have a non-integer tone the bins nearest the frequency will be largest. The frequency can be calculated/estimated using two or three of these bin values. If you have a noiseless pure tone the frequency can be calculated exactly. If there is any noise, or other non-integer tones present, the calculation becomes an estimation. This topic is known as Frequency Estimation Formulas. There are many of them. Some more efficient than others, some more accurate. It depends on your needs which one you should use. As far as I know, I am the first to derive the exact formula found in my blog article titled "Exact Frequency Formula for a Pure Real Tone in a DFT" which can be found here: http://www.dsprelated.com/showarticle/773.php At the end of the article I have a link to a paper that compares various formulas against complex and real signals written by a forum contributor named Julien. You should note that my formula is for real valued signals although it does remarkably well on a complex signal as well. I have a blog article in the pipeline for the complex signal case. You can find a web page by Eric Jacobsen, another forum contributor, title "Eric Jacobsen's Frequency Estimation Page" which can be found here: www.ericjacobsen.org/fe.htm There is second page as well which is linked from the first page. Picking apart a multiple tone signal is the subject of future blog articles of mine. Ced --------------------------------------- Posted through http://www.DSPRelated.com
On Fri, 01 Jan 2016 22:10:35 -0600, "Sharan123" <99077@DSPRelated>
wrote:

>>For the length-N input vector and the natural ordering of the FFT >>outputs (i.e., using the index definitions for general transforms), >>each output bin is the correlation of the input with a sinusoid of k >>cycles per N samples, where k is the index of the bin. In other >>words, bin 1 will contain the cross-correlation of the input and a >>(complex) sinusoid with exactly 1 cycle per N samples. Bin 2 will >>correlate against 2 cycles/N samples, etc. Bin 0 has the DC energy, >>and bin -1 (folded about DC, or bin N-1), has the cross-correlation of >>the input against a (complex) sinusoid of 1 cycle/N samples rotating >>in the opposite direction of that used for bin 1. > >Dear Eric, > >With respect to the above algorithm, would there be a change in outputs if >multiple cycles for a given frequency at the input are present?
No, there shouldn't be any difference between the algorithms. They're all intended to be equivalent to the DFT, which is defined for any arbitrary length, and if they are not equivalent to the DFT then they are faulty. The reason to use other algorithms is that the DFT is not computationally efficient, so, especially for long vectors (i.e., large N), there is a substantial benefit in computation time to using an FFT of some configuration or other.
>The example I have tried does give accurate results but I just want to >your comments ... > >--------------------------------------- >Posted through http://www.DSPRelated.com
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
Dear Eric, Steve,

Thanks a lot for the pointers. I am able to work out a simple example that
uses two individual sinusoidal signals, converts this into frequency
domain;  removed higher frequency component in frequency domain and
convert back into time domain. The results are expected.

But I still have one lingering doubt in mind ...

Assume I take a single sinusoidal signal.
Now I take 10, 20, 30 samples. All these meet Nyquist sampling rate.
If I take FFT of above 3 signals then I end up with 10, 20, 30 bins.
Now, how can I associate bin with actual frequency.

I know that sampling frequency has a role to play in this but I am not
sure how to go about it ...

---------------------------------------
Posted through http://www.DSPRelated.com
>Dear Eric, Steve, > >Thanks a lot for the pointers. I am able to work out a simple example
that
>uses two individual sinusoidal signals, converts this into frequency >domain; removed higher frequency component in frequency domain and >convert back into time domain. The results are expected. > >But I still have one lingering doubt in mind ... > >Assume I take a single sinusoidal signal. >Now I take 10, 20, 30 samples. All these meet Nyquist sampling rate. >If I take FFT of above 3 signals then I end up with 10, 20, 30 bins. >Now, how can I associate bin with actual frequency. > >I know that sampling frequency has a role to play in this but I am not >sure how to go about it ... >
folks sorry. I meant Cedron when I wrote Steve above --------------------------------------- Posted through http://www.DSPRelated.com
>>I know that sampling frequency has a role to play in this but I am not >>sure how to go about it ... >> > >folks sorry. I meant Cedron when I wrote Steve above >--------------------------------------- >Posted through http://www.DSPRelated.com
No worries. Here's an explanation that should help: cycles per time unit = Hz (usually) samples per time unit = Sampling Rate samples per frame = N cycles per frame = bin number frames per time unit = frame rate = Sampling Rate / N Hz = bin number * ( Sampling Rate / N ) Hz (cycles per second) stands for your actual frequency. It could just as well been RPM (revolutions per minute), depends on your time unit. Ced --------------------------------------- Posted through http://www.DSPRelated.com
>>>I know that sampling frequency has a role to play in this but I am not >>>sure how to go about it ... >>> >> >>folks sorry. I meant Cedron when I wrote Steve above >>--------------------------------------- >>Posted through http://www.DSPRelated.com > >No worries. Here's an explanation that should help: > >cycles per time unit = Hz (usually) > >samples per time unit = Sampling Rate > >samples per frame = N > >cycles per frame = bin number > >frames per time unit = frame rate = Sampling Rate / N > >Hz = bin number * ( Sampling Rate / N ) >
Thank you so much ... --------------------------------------- Posted through http://www.DSPRelated.com
Sharan123 <99077@DSPRelated> wrote:

>Assume I take a single sinusoidal signal. >Now I take 10, 20, 30 samples. All these meet Nyquist sampling rate. >If I take FFT of above 3 signals then I end up with 10, 20, 30 bins. >Now, how can I associate bin with actual frequency.
>I know that sampling frequency has a role to play in this but I am not >sure how to go about it ...
One can look at it the following way: The result of a DFT is a set of amplitudes at a finite set of discrete frequencies. There is no "actual frequency" other than these. Also, _unless you place restrictions on the input to the DFT_, there is no way of stating anything about frequency that is more precise than the spacing between these digital frequencies. The information simply isn't there. With restrictions on the input (such as, it must be a sinusoidal segment) you can make better, or at least different statements about the nature of that signal, but it's still a bit illusory to be talking about a single actual frequency, since the sinusoidal segment has energy spread over many (in fact all) frequencies. Simply put the discrete transform does not work the same way as the continuous-time Fourier transform and you cannot make analogous statements about the results. Hope this is useful. Steve
>One can look at it the following way: > >The result of a DFT is a set of amplitudes at a finite set of >discrete frequencies. There is no "actual frequency" other than >these. Also, _unless you place restrictions on the input to the >DFT_, there is no way of stating anything about frequency that >is more precise than the spacing between these digital frequencies. >The information simply isn't there. > >With restrictions on the input (such as, it must be a sinusoidal >segment) you can make better, or at least different statements >about the nature of that signal, but it's still a bit illusory >to be talking about a single actual frequency, since the sinusoidal >segment has energy spread over many (in fact all) frequencies. > >Simply put the discrete transform does not work the same way >as the continuous-time Fourier transform and you cannot make >analogous statements about the results. > >Hope this is useful.
Dear Steve, Thanks a lot. Your response really put things in perspective ... --------------------------------------- Posted through http://www.DSPRelated.com
> >Simply put the discrete transform does not work the same way >as the continuous-time Fourier transform and you cannot make >analogous statements about the results. > >Hope this is useful. > >Steve
That is incredibly useful. The corollary is that you learn all about the Discrete FT without knowing anything about the Continuous FT. Ced --------------------------------------- Posted through http://www.DSPRelated.com