User:Evilotto41/sandbox

Fast Fourier Transforms – An Overview
Fast-Fourier Transforms (FFTs) are the mathematical processes which transform signals in the time domain into spectral displays in the frequency domain.

Digitization – A Review
In order to process waveforms in the digital world, they must be digitized. Digitization is the best process of representing analog waveforms that are constrained within the limits of time and voltage. As time progresses, a digitizer samples the analog waveform and defines it by the nearest crossing points of the sample time and quantizing level.

Sample Time
The amount of time between consecutive samples is bound by the highest frequency component of the sample. In order to accurately sample any frequency component, one complete cycle of that component must be (at a minimum) sampled just over 2 times. This is a derivation of Nyquist’s Theory and has been defined for our purposes to be 2.5-times the highest frequency in the system.

Commonly, we view waveforms using a time-based visualization; mapped on a graph where time progresses along the X axis and amplitude is defined along the Y axis. At each sample period, the digitizer marks the time component along the X axis and then records the amplitude along a grid of quantizing points that are defined along the Y axis.

Sample Period & Sample Rate
Conforming to Nyquist’s Theory, the sample rate must be 2.5 times the highest frequency component. Because electronic systems operate using Intermediate Frequency (IF), the highest frequency component equates to the bandwidth of the electronic system (i.e., a receiver).


 * Given a receiver with a 5.0-MHz bandwidth:
 *  Sample Rate  = 5x106 x 2.5 = 12.5 x 106 or 12.5 MHz. – or 12.5-million samples every second. The period between individual samples is the inverse of the sample rate (1/12.5 x 106 = 8 x 10-8 or 80 nanoseconds), which defines the interval between samples or ‘’’ Sample Period ’’’.

Quantization Levels
A digitizer is defined by the number of quantizing levels described in a binary bit system defined by 2n, where n is the number of bits. If a digitizer divides voltage range equally into 256 discrete levels, it is said to be an 8-bit digitizer (28 = 256 or Log2(256) = 8 bits).

Quantizing levels simply report the closest point of intersection where the analog waveform falls on the digital grid of time and amplitude. Quantizing levels are equal slices of the amplitude axis, equally distributed over the range of the system. The selection of the number of quantizing levels is dependent upon the desired fidelity.

At every sample period the digitizer finds the amplitude of the analog waveform and snaps it to the closest of one of two adjacent quantizing levels. Anything above half of the quantizing level will snap to the upper point, anything below half will snap to the lower point. The difference between the originally sampled analog waveform and the adjustments made by assigning the sample voltage to a discrete quantizing level is described as ‘’’quantizing error’’’.

Back to FFTs
FFTs are defined by the size of the window that is used. The size of the window is simply the number of samples taken to perform the FFT. Because each sample equates to an interval, the size of the FFT window will constitute a period of time. From the previous example:
 * Sample Period = 80 nsec
 * FFT Size = 1024


 * 8 x 10-8 sec × 1024 samples = 81.92 usec

In short, processing a 1024-point FFT requires 81.92 usec worth of time-based data. The output of the FFT process will be a compilation of the frequency components contained within that 81.92-usec period. The 81.92-usec period also defines the frequency resolution of the spectral display. Inverting the time resolution determines the frequency resolution, therefore: 1 ÷ 81.92 usec = 12.207 kHz.

In essence, you can think of a spectral-domain display as being divided into an equal number of frequency bins, as Total BW ÷ Frequency Resolution. From the example:


 * 5.0 MHz ÷ 12.207 kHz ≈ 410 frequency "bins"

In effect, a 1024-point FFT can only represent the power present in the frequencies between 0 and 12.207 kHz, and then between 12.207 and 24.414 kHz, and so on. A specific frequency component at 17.567 kHz will be represented as a portion the total contribution of all frequency components contained between 12.207 kHz and 24.414 kHz. Therefore, you can only resolve any frequency measurement to +/- 12.207 kHz.

Concurrently, the resulting FFT output is limited to blocks of time. Because we used 81.92 usec of time to find all the frequency components to a resolution of 12.207 kHz, any specific event that occurred within that 81.92-usec period will not be specifically represented. The time between 0 second and 81.92 usec is a single unit of time.

If you were to graph these limitations in an X vs. Y plot, where frequency is on the X axis and time is on the Y axis, you would create pixels. In this case, each pixel would be 81.92-usec high and 12.207-kHz wide. Within that pixel would be the total, factored components of time and frequency, represented as one value.

Reciprocity
A digital camera defines its ability to resolve images on pixel size. As the physical dimensions of the sensor are fixed, the only way to increase the number of pixels is to make them uniformly smaller. Because you must uniformly reduce the size of the pixel you are simply scaling a square. FFTs do not work this way.

To reduce frequency resolution, you must increase the size of the FFT window, and thus the duration of the sample. If the FFT size previous example is doubled and all other variable remain the same:


 * FFT Size = 2048
 * Sample Period: 80.0 nsec


 * 8 x 10-8 × 2048 = 163.84 usec
 * 1 ÷ 163.84 msec ≈ 6.104 kHz


 * The frequency bin gets smaller but the time bin is twice as long, so the pixel elongates.

Reciprocity, with regards to FFTs, limits the capacity to either being able to resolve frequency  or  time with higher degrees of accuracy. The domain where measurements are required (frequency or time) dictate the FFT used.

Overlap
Using overlap, time can be somewhat restored, with some limitations. Overlap (typically expressed in percentages) involves re-processing a portion of the previous time segment to gain that portion of time resolution back. From the current example:


 * FFT Size: 2048
 * FFT Window: 163.84 usec
 * Frequency Resolution: 6.104 kHz
 * Time Resolution: 163.84 usec (= FFT Window)

If a 50% overlap is applied, each time segment will back up 50% over the previous and begin calculating the FFT. As a result:
 * FFT Size: 2048
 * FFT Window: 163.84 usec
 * Overlap: 50%
 * Frequency Resolution: 6.104 kHz
 * Time Resolution: 81.92 usec. (= FFT Window × 50%)