Main Content

Cross-Spectrum Estimator

Estimate cross-power spectrum density

Library

Estimation / Power Spectrum Estimation

dspspect3

  • Cross-Spectrum Estimator block

Description

The Cross-Spectrum Estimator block outputs the frequency cross-power spectrum density of two real or complex input signals, x and y, via Welch’s method of averaged modified periodograms. The input signals must be of the same size and data type.

The Cross-Spectrum Estimator block computes the current power spectrum estimate by averaging the last N power spectrum estimates, where N is the number of spectral averages defined in Number of spectral averages. The block buffers the input data into overlapping segments. You can set the length of the data segment and the amount of data overlap through the parameters set in the block dialog box. The block computes the power spectrum based on the parameters set in the block dialog box.

Each column of the input signal is treated as a separate channel. If the input is a two-dimensional signal, the first dimension represents the channel length (or frame size) and the second dimension represents the number of channels. If the input is a one-dimensional signal, then it is interpreted as a single channel.

Parameters

Window length source

Source of the window length value. You can set this parameter to:

  • Same as input frame length (default) — Window length is set to the frame size of the input.

  • Specify on dialog — Window length is the value specified in Window length.

This parameter is nontunable.

Window length

Length of the window, in samples, used to compute the spectrum estimate, specified as a positive integer scalar greater than 2. This parameter applies when you set Window length source to Specify on dialog. The default is 1024. This parameter is nontunable.

Window Overlap (%)

Percentage of overlap between successive data windows, specified as a scalar in the range [0, 100). The default is 0. This parameter is nontunable.

Averaging method

Specify the averaging method as Running or Exponential. In the running averaging method, the block computes an equally weighted average of a specified number of spectrum estimates defined by the Number of spectral averages parameter. In the exponential method, the block computes the average over samples weighted by an exponentially decaying forgetting factor.

Number of spectral averages

Number of spectral averages, specified as a positive integer scalar. The default is 1. The spectrum estimator computes the current power spectrum estimate by averaging the last N power spectrum estimates, where N is the number of spectral averages defined in Number of spectral averages. This parameter is nontunable.

This parameter applies when Averaging method is set to Running.

Specify forgetting factor from input port

Select this check box to specify the forgetting factor from an input port. When you do not select this check box, the forgetting factor is specified through the Forgetting factor parameter.

This parameter applies when Averaging method is set to Exponential.

Forgetting factor

Specify the exponential weighting forgetting factor as a scalar value greater than zero and smaller than or equal to one. The default is 0.9.

This parameter applies when you set Averaging method to Exponential and clear the Specify forgetting factor from input port parameter.

FFT length source

Source of the FFT length value. You can set this parameter to:

  • Auto (default) — FFT length is set to the frame size of the input.

  • Property — FFT length is the value specified in FFT length.

This parameter is nontunable.

FFT length

Length of the FFT used to compute the spectrum estimates, specified as a positive integer scalar. This parameter applies when you set FFT length source to Property. The default is 1024. This parameter is nontunable.

Window function

Window function for the cross-spectrum estimator, specified as one of Chebyshev | Flat Top | Hamming | Hann | Kaiser | Rectangular. The default is Hann. This parameter is nontunable.

Sidelobe attenuation of window (dB)

Side lobe attenuation of the window, specified as real positive scalar. This parameter applies when you set Window function to Chebyshev or Kaiser. The default is 60. This parameter is nontunable.

Frequency range

Frequency range of the cross-spectrum estimator. You can set this parameter to:

  • centered (default) — The cross-spectrum estimator computes the centered two-sided spectrum of complex or real input signals, x and y. The length of the cross-spectrum estimate is equal to the FFT length. The spectrum estimate is computed over the frequency range [-SampleRate/2 SampleRate/2] when the FFT length is even and [-SampleRate/2 SampleRate/2] when FFT length is odd.

  • onesided — The cross-spectrum estimator computes the one-sided spectrum of real input signals, x and y. When the FFT length, NFFT is even, length of the cross-spectrum estimate is (NFFT/ 2) + 1, and is computed over the frequency range [0 SampleRate/2]. When the FFT length, NFFT is odd, length of the cross-spectrum estimate is (NFFT + 1)/ 2, and is computed over the frequency range [0 SampleRate/2].

  • twosided — The cross-spectrum estimator computes the two-sided spectrum of complex or real input signals, x and y. The length of the cross-spectrum estimate is equal to the FFT length. The spectrum estimate is computed over the frequency range [0 SampleRate], where SampleRate is the sample rate of the input signal.

This parameter is nontunable.

Inherit sample rate from input

When you select this check box, the block’s sample rate is computed as N/Ts, where N is the frame size of the input signal, and Ts is the sample time of the input signal. When you clear this check box, the block sample rate is the value specified in Sample rate (Hz). By default, this check box is selected.

Sample rate (Hz)

Sample rate of the input signal, specified as a positive scalar value. The default is 44100. This parameter applies when you clear the Inherit sample rate from input check box. This parameter is nontunable.

Simulate using

Type of simulation to run. You can set this parameter to:

  • Code generation (default)

    Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but provides faster simulation speed than Interpreted execution.

  • Interpreted execution

    Simulate model using the MATLAB®  interpreter. This option shortens startup time but has slower simulation speed than Code generation.

Supported Data Types

PortSupported Data Types

Input

  • Double-precision floating point

  • Single-precision floating point

Output

  • Double-precision floating point

  • Single-precision floating point

Algorithms

expand all

References

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

[2] Kay, Steven M. Modern Spectral Estimation: Theory and Application. Englewood Cliffs, NJ: Prentice Hall, 1999.

[3] Stoica, Petre, and Randolph L. Moses. Spectral Analysis of Signals. Englewood Cliffs, NJ: Prentice Hall, 2005.

[4] Welch, P. 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, No. 2, June 1967, pp. 70–73.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2015a