Main Content

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 Welch’s nonparametric method of averaging modified periodogram and the filter bank method to estimate the power spectrum of a streaming signal in real time. You can launch the spectrum analyzer using the dsp.SpectrumAnalyzer System object™ in MATLAB® and the Spectrum Analyzer block in Simulink®.

Welch’s Algorithm of Averaging Modified Periodograms

To use the Welch method in the spectrum analyzer, set the Method parameter 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.

The algorithm in the Spectrum Analyzer block consists of these steps:

  1. The block buffers the input into N point data segments. Each data segment is split up into L overlapping data segments, each of length M, overlapping by D points. The data segments can be represented as:


    • If D = M/2, the overlap is 50%.

    • If D = 0, the overlap is 0%.

    The block uses the RBW or the Window Length setting in the Spectrum Settings pane to determine the data window length. Then, it partitions the input signal into a number of windowed data segments.

    The spectrum analyzer requires a minimum number of samples (Nsamples) to compute a spectral estimate. This number of input samples required to compute one spectral update is shown as Samples/update in the Main options pane. This value is directly related to the resolution bandwidth, RBW, by the following equation:


    • Op, the amount of overlap (%) between the previous and current buffered data segments, is specified through the Overlap (%) parameter in the Window options pane.

    • NENBW, the normalized effective noise bandwidth of the window depends on the windowing method. This parameter is shown in the Window options pane.

    • Fs is the sample rate of the input signal.

    When in RBW mode, the window length required to compute one spectral update, Nwindow, is directly related to the resolution bandwidth and normalized effective noise bandwidth:


    When in Window length mode, the window length is used as specified.

    The number of input samples required to compute one spectral update, Nsamples, is directly related to the window length and the amount of overlap:


    When you increase the overlap percentage, fewer new input samples are needed to compute a new spectral update. For example, the table shows the number of input samples required to compute one spectral update when the window length is 100.


    The normalized effective noise bandwidth, NENBW, is a window parameter determined by the window length, Nwindow, and the type of window used. If w(n) denotes the vector of Nwindow window coefficients, then NENBW is:


    When in RBW mode, you can set the resolution bandwidth using the value of the RBW parameter on the Main options pane. You must specify a value so that there are at least two RBW intervals over the specified frequency span. The ratio of the overall span to RBW must be greater than two:


    By default, the RBW parameter on the Main options pane is set to Auto. In this case, the Spectrum Analyzer determines the appropriate value so that there are 1024 RBW intervals over the specified frequency span. Thus, when you set RBW to Auto, RBW is calculated by: RBWauto=span1024

    When in window length mode, you specify Nwindow and the resulting RBW is


  2. Apply a window to each of the L overlapping data segments in the time domain. Most window functions afford more influence to the data at the center of the set than to the data at the edges, which represents a loss of information. To mitigate that loss, the individual data sets are commonly overlapped in time. For each windowed segment, compute the periodogram by computing the discrete Fourier transform. Then compute the squared magnitude of the result, and divide the result by M.


    where U is a normalization factor for the power in the window function and is given by



    You can specify the window using the Window parameter.

  3. To determine the Welch power spectrum estimate, the Spectrum Analyzer block averages the result of the periodograms for the last L data segments. The averaging reduces the variance, compared to the original N point data segment.


    L is specified through the Averages parameter in the Trace options pane.

  4. The Spectrum Analyzer block computes the power spectral density using:



Filter Bank

To use the filter bank approach in the spectrum analyzer, set the Method parameter 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 Algorithms section in dsp.SpectrumEstimator. For more information on the analysis filter bank and how it is implemented, see the More About and the Algorithm sections in dsp.Channelizer.


[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.

See Also



Related Topics