Home

Daqarta for DOS Contents

Introduction

Free Registration

Daqarta for DOS
Data AcQuisition And Real-Time Analysis
Shareware for Legacy Systems
(Use Daqarta for Windows with modern systems)

The above image shows two spectra of sine waves created by the Virtual Source. Both sine waves are at the same level, and the only difference is that one is at 3651 Hz and the other is at 3981 Hz. (The X-axis has been eXpanded slightly to better show the peak regions.) In the yellow trace the source is at 3651 Hz, which has a nearly-integer number of cycles in the 512 sample points acquired for the FFT at the sample rate of 19887 Hz:

``` 3651 * 512 / 19887 = 93.997 cycles
```
The FFT always computes the spectrum as though the last sample in each 512-sample set was followed immediately by the first to form an endlessly repeating signal, which in this case is a pretty good approximation

In the blue trace the source is at 3981 Hz, which is far from an integer number of cycles:

``` 3981 * 512 / 19887 = 102.49 cycles
```
Since this sample set ends halfway through a cycle, the next set will not be at all like the prior one... it must finish out the remainder of the cycle before repeating. The spectrum thus shows the frequency components that would be present if the input DID repeat exactly, including the discontinuity of jumping from the peak of the odd half-cycle at the end, back to the start of a new cycle at the beginning. That discontinuity causes lots of extra frequency components, which are the spectral equivalent to the audible "click" that would result. Since the click rate is once per 512 samples, there are harmonics every
``` 19887 / 512 = 38.84 Hz
```
which is the line-spacing of the spectrum. This "spectral leakage" not only forms "skirts" around the desired frequency, it also represents energy that has leaked away from the peak, reducing its apparent level.

Since it will not always be possible to adjust the input frequencies and/or the sample rate to get an integer number of cycles in the sample set, a general approach is to apply a "window" to the input samples, as shown below:

The above image shows the same 3981 Hz spectrum as before in yellow at the top, labeled "Rect" for "Rectangular" window (which is no window at all). Below it in blue is the Hanning-windowed version of the same input, labeled "Hann". The spectral leakage has been largely eliminated, and the peak energy has been likewise restored. The windowing operation achieves this by gently tapering off the sample set at the beginning and end, as shown below:

In the above image, the blue trace shows the shape of the Hanning window that has been applied to the waveform below it in yellow. Since any discontinuity at either end has been tapered away, it can no longer cause the harmonics that are the spectral leakage skirts seen previously. Although the window greatly cuts the energy of the wave, it cuts everything by a known factor which Daqarta restores automatically when the spectrum is displayed. Note that normally the 'Windo' option is only activated when the spectrum is shown in FFT mode. Daqarta doesn't apply it to the waveform unless specifically requested by activating it in that mode. Doing so, as shown here, allows direct visualization of the windowed input, such as to check that some desired feature of a complex signal is not adversely affected. The 'Windo' state is maintained separately when toggling between waveform and FFT modes.

GO: