## Spectral Analysis

Spectral analysis is the process of estimating the power spectrum (PS) of a signal from its time-domain representation. Spectral density characterizes the frequency content of a signal or a stochastic process. Intuitively, the spectrum decomposes the signal or the stochastic process into the different frequencies, and identifies periodicities. The most commonly used instrument for performing spectral analysis is the spectrum analyzer.

Spectral analysis is done based on the nonparametric methods and the parametric methods. Nonparametric methods are based on dividing the time-domain data into segments, applying Fourier transform on each segment, computing the squared-magnitude of the transform, and summing and averaging the transform. Nonparametric methods such as modified periodogram, Bartlett, Welch, and the Blackman-Tukey methods, are a variation of this approach. These methods are based on measured data and do not require prior knowledge about the data or the model. Parametric methods are model-based approaches. The model for generating the signal can be constructed with a number of parameters that can estimated from the observed data. From the model and estimated parameters, the algorithm computes the power spectrum implied by the model.

The spectrum analyzer in DSP System Toolbox™ uses the filter bank method and the Welch’s nonparametric method of
averaging modified periodogram to estimate the power spectrum of a streaming signal in
real time. You can launch the spectrum analyzer using the `spectrumAnalyzer`

object in MATLAB^{®} and the Spectrum Analyzer block in Simulink^{®}.

### Filter Bank

To use the filter bank approach in the spectrum analyzer, set the
**Method** parameter in the **Estimation** tab
of the Spectrum Analyzer toolstrip to `Filter bank`

. In the
filter bank approach, the analysis filter bank splits the broadband input signal
into multiple narrow subbands. The spectrum analyzer computes the power in each
narrow frequency band and the computed value is the spectral estimate over the
respective frequency band. For signals with relatively small length, the filter bank
approach produces a spectral estimate with a higher resolution, a more accurate
noise floor, and peaks more precise than the Welch method, with low or no spectral
leakage. These advantages come at the expense of increased computation and slower
tracking.

For information on how the filter bank computes the power, see the Spectrum Estimation — Filter Bank section
in Spectrum Analyzer block reference page. For more information on
the analysis filter bank and how it is implemented, see the More About and the Algorithm sections in
`dsp.Channelizer`

.

### Welch’s Algorithm of Averaging Modified Periodograms

To use the Welch method in the spectrum analyzer, set the
**Method** parameter in the **Estimation** tab
of the Spectrum Analyzer toolstrip to `Welch`

. The Welch's
technique to reduce the variance of the periodogram breaks the time series into
overlapping segments. This method computes a modified periodogram for each segment
and then averages these estimates to produce the estimate of the power spectrum.
Because the process is wide-sense stationary and Welch's method uses PS estimates of
different segments of the time series, the modified periodograms represent
approximately uncorrelated estimates of the true PS. The averaging reduces the
variability.

The segments are multiplied by a window function, such as a Hann window, so that
Welch's method amounts to averaging modified periodograms. Because the segments
usually overlap, data values at the beginning and end of the segment tapered by the
window in one segment, occur away from the ends of adjacent segments. The overlap
guards against the loss of information caused by windowing. In the Spectrum
Analyzer block, you can specify the window using the
**Window** parameter in the **Estimation**
tab.

Given the input signal `x`

, the spectrum analyzer:

Multiplies

`x`

by the given window and scales the result by the window power.Computes the FFT of the signal,

`Y`

, and then calculates the square magnitude using`Z = Y.*conj(Y)`

.Computes the current power spectrum estimate by calculating the moving average of the last

*P*number of*Z*vectors, and then scales the answer by the sample rate.

For more details on how the Spectrum Analyzer uses the Welch's method, see the Spectrum Estimation — Welch's Method section in Spectrum Analyzer block reference page.

## References

[1] Proakis, John G., and Dimitris G. Manolakis. *Digital
Signal Processing*. 3rd ed. Upper Saddle River, NJ: Prentice
Hall, 1996.

[2] Hayes, Monson H. *Statistical Digital Signal Processing and
Modeling* Hoboken, NJ: John Wiley & Sons, 1996.