## Spectrum Computation in Signal Analyzer

To compute signal spectra, Signal Analyzer finds a compromise between the spectral resolution achievable with the entire length of the signal and the performance limitations that result from computing large FFTs.

• If the resolution resulting from analyzing the full signal is achievable, the app computes a single modified periodogram of the whole signal using an adjustable Kaiser window.

• If the resolution resulting from analyzing the full signal is not achievable, the app computes a Welch periodogram: It divides the signal into overlapping segments, windows each segment using a Kaiser window, and averages the periodograms of the segments.

### Spectral Windowing

Any real-world signal is measurable only for a finite length of time. This fact introduces nonnegligible effects into Fourier analysis, which assumes that signals are either periodic or infinitely long. Spectral windowing, which consists of assigning different weights to different signal samples, deals systematically with finite-size effects.

The simplest way to window a signal is to assume that it is identically zero outside of the measurement interval and that all samples are equally significant. This “rectangular window” has discontinuous jumps at both ends that result in spectral ringing. All other spectral windows taper at both ends to lessen this effect by assigning smaller weights to samples close to the signal edges.

The windowing process always involves a compromise between conflicting aims: improving resolution and decreasing leakage.

• Resolution is the ability to know precisely how the signal energy is distributed in the frequency space. A spectrum analyzer with ideal resolution can distinguish two different tones (pure sinusoids) present in the signal, no matter how close in frequency. Quantitatively, this ability relates to the mainlobe width of the transform of the window.

• Leakage is the fact that, in a finite signal, every frequency component projects energy content throughout the complete frequency span. The amount of leakage in a spectrum can be measured by the ability to detect a weak tone from noise in the presence of a neighboring strong tone. Quantitatively, this ability relates to the sidelobe level of the frequency transform of the window.

The better the resolution, the higher the leakage, and vice versa. At one end of the range, a rectangular window has the narrowest possible mainlobe and the highest sidelobes. This window can resolve closely spaced tones if they have similar energy content, but it fails to find the weaker one if they do not. At the other end, a window with high sidelobe suppression has a wide mainlobe in which close frequencies are smeared together.

Signal Analyzer uses Kaiser windows to carry out windowing. For Kaiser windows, the fraction of the signal energy captured by the mainlobe depends most importantly on an adjustable shape factor, β. The shape factor ranges from β = 0, which corresponds to a rectangular window, to β = 40, where a wide mainlobe captures essentially all the spectral energy representable in double precision. An intermediate value of β ≈ 6 approximates a Hann window closely. To control β, use the Leakage slider on the Spectrum and Spectrogram tabs. If you set the leakage to using the slider, then and β are related by β = 40(1 – ). See `kaiser` for more details.

 51-point Hann window and 51-point Kaiser window with β = 5.7 in the time domain 51-point Hann window and 51-point Kaiser window with β = 5.7 in the frequency domain

### Parameter and Algorithm Selection

To compute the spectra of the signals appearing on a given display, Signal Analyzer initially determines the resolution bandwidth, which measures how close two tones can be and still be resolved. The resolution bandwidth has a theoretical value of

`${\text{RBW}}_{\text{theory}}=\frac{\text{ENBW}}{{t}_{\mathrm{max}}-{t}_{\mathrm{min}}}.$`

• tmax – tmin, the record length, is the time-domain duration of the selected signal region.

Use the panner to select and adjust the record length or region of interest. Equivalently, you can zoom in on the time-domain plot or change the limits on the Time tab.

• ENBW is the equivalent noise bandwidth of the spectral window. See `enbw` for more details.

Use the Leakage slider in the Spectrum tab to control the ENBW. The minimum value in the slider range corresponds to a Kaiser window with β = 40. The maximum value corresponds to a Kaiser window with β = 0.

In practice, however, the app might lower the resolution. Lowering the resolution makes it possible to compute the spectrum in a reasonable amount of time and to display it with a finite number of pixels. For these practical reasons, the lowest resolution bandwidth the app can use is

`${\text{RBW}}_{\text{performance}}=4×\frac{{f}_{\text{span}}}{4096-1},$`

where fspan is the width of the frequency range specified by setting Frequency Limits values on the Spectrum tab. If you do not specify a frequency range, the app uses as fspan the maximum sample rate among all the signals in the display. RBWperformance cannot be adjusted.

To compute the spectrum of a signal, the app chooses the larger of the two values:

`$\text{RBW}=\mathrm{max}\left({\text{RBW}}_{\text{theory}},{\text{RBW}}_{\text{performance}}\right).$`

This target resolution bandwidth is displayed on the Spectrum tab.

• If the resolution bandwidth is RBWtheory, then Signal Analyzer computes a single modified periodogram for the whole signal. The app uses a Kaiser window with the slider-controlled shape factor and applies zero-padding when the time limits on the axes exceed the signal duration. See `periodogram` for more details.

• If the resolution bandwidth is RBWperformance, then Signal Analyzer computes a Welch periodogram for the signal. The app:

1. Divides the signals into overlapping segments.

2. Windows each segment separately using a Kaiser window with the specified shape factor.

3. Averages the periodograms of all the segments.

Welch’s procedure is designed to reduce the variance of the spectrum estimate by averaging different “realizations” of the signals, given by the overlapping sections, and using the window to remove redundant data. See `pwelch` for more details.

• The length of each segment (or, equivalently, of the window) is computed using

where max(fNyquist) is the highest Nyquist frequency among all the signals in the display. (If there is no aliasing, the Nyquist frequency is one-half the sample rate.)

• The stride length is found by adjusting an initial estimate,

so that the first window starts exactly on the first sample of the first segment and the last window ends exactly on the last sample of the last segment.

### Zooming

If you zoom in on a region of a signal spectrum using one of the zoom actions on the Display tab, the app does not change the resolution bandwidth. Instead, Signal Analyzer performs an optical zooming, using bandlimited interpolation to display a smooth spectral curve.

Zooming in on a time-domain region of a signal is equivalent to setting the record length or region of interest with the panner.

If the selected time interval extends beyond the ends of a signal, the app zero-pads the signal. If a signal has no samples within the selected time interval, the app displays nothing.

## References

[1] harris, fredric j. “On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform.” Proceedings of the IEEE®. Vol. 66, January 1978, pp. 51–83.

[2] Welch, Peter D. “The Use of Fast Fourier Transform for the Estimation of Power Spectra: A Method Based on Time Averaging Over Short, Modified Periodograms.” IEEE Transactions on Audio and Electroacoustics. Vol. 15, June 1967, pp. 70–73.