Estimate power spectrum or powerdensity spectrum
Estimation / Power Spectrum Estimation
dspspect3
The Spectrum Estimator block outputs the power spectrum or powerdensity spectrum of a real or complex input signal, using the Welch method of averaged modified periodograms and the filter bank approach.
When you choose the filter bank approach, the block uses an analysis filter bank to estimate the power spectrum. The filter bank approach produces a spectral estimate with a higher resolution, a more accurate noise floor, and more precise peaks than the Welch method, with low or no spectral leakage. They come at the expense of increased computation and slower tracking.
When you choose the Welch method, the block computes the averaged modified periodograms to compute the spectral estimate. The block buffers the input data into overlapping segments. Use the block parameters to set the length of the data segments, the amount of data overlap between consecutive segments, and other features of the power spectrum.
For more information on the Welch method and the filter bank method, see Algorithms.
Each column of the input signal is treated as a separate channel. If the input is a twodimensional 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 onedimensional signal, then it is interpreted as a single channel.
Specify the spectral estimation method.
Filter bank
(default) —
An analysis filter bank splits the broadband input signal
into multiple narrow subbands. The block computes the power
in each narrow frequency band, and the computed value is the
spectral estimate over the respective frequency band.
Welch
— The block uses
the Welch averaged modified periodograms method to compute
the power spectrum over the narrow subbands.
Specify the number of filter coefficients, or taps, for each frequency band. This value corresponds to the number of filter coefficients per polyphase branch. The total number of filter coefficients is equal to Number of taps per band times the FFT length.
This parameter applies when you set Method to
Filter bank
. The default is 12.
Type of spectrum to compute. You can set this parameter to:
Power
(default) —
Compute the power spectrum.
Power density
— Compute
the power spectral density.
This parameter is nontunable.
Frequency resolution method. You can set this parameter to:
Auto
(default) — The
Spectrum Estimator block computes the resolution bandwidth
(RBW) so that the frequency span fits 1024 RBW intervals.
Welch method — The window length, winLen, is calculated using . NENBW is the equivalent noise bandwidth of the window and Fs is the sample rate.
Filter bank method — The FFT length is the ceiling of the ratio of Sample rate (Hz) to the computed resolution bandwidth.
RBW
— Specify the
resolution bandwidth, which is used to determine the window
length (Welch method) or the FFT length (filter bank
method). When the block uses the Welch method, the behavior
is equivalent to that of the Spectrum Analyzer
block. The window length is calculated using . NENBW is the
equivalent noise bandwidth of the window and
Fs is the sample rate. The FFT length
is equal to the ceiling of the ratio of Sample
rate (Hz) to RBW
(Hz).
Window length
— Specify
the window or segment length to use in the Welch algorithm.
This option appears when you set Method
to Welch
.
Number of frequency bands
— Specify the number of polyphase branches of the
analysis filter bank. This value corresponds to the FFT
length that the filter bank uses. This option appears when
you set Method to Filter
bank
.
This parameter is nontunable.
Resolution bandwidth, specified as a positive scalar in Hz. The
default is 5
. This parameter applies when you set
Frequency resolution method to
RBW
. The ceiling of the ratio of the
frequency span to RBW must be greater than 2
.
This parameter is nontunable.
Source of the number of frequency bands. This parameter applies when
you set Method to Filter
bank
and Frequency resolution
method to Number of frequency
bands
. You can set this parameter to:
Same as input frame length
(default) — The FFT length is set to the frame size
of the input.
Specify on dialog
— The
FFT length is the value you specify in Number of
bands.
This parameter is nontunable.
Number of frequency bands, or the FFT length the filter bank uses to
compute the power spectral estimate, specified as a positive scalar. The
default is 1024
. This parameter applies when you set
Method to Filter
bank
, Frequency resolution method
to Number of frequency bands
, and
Number of bands source to Specify
on dialog
. This parameter is nontunable.
Source of the window length value. This parameter applies when you set
Method to Welch
and
Frequency resolution method to
Window length
. You can set this parameter to:
Same as input frame length
(default) — Window length is set to the frame size of
the input. Specify this option to obtain behavior equivalent
to that of the Periodogram
block.
Specify on dialog
—
Window length is the value you specify in the
Window length parameter.
This parameter is nontunable.
Length of the window used to compute the spectrum estimate, specified
as a positive integer scalar greater than 2
. The
default is 1024
. This parameter applies when you set
Method to Welch
,
Frequency resolution method to
Window length
, and Window
length source to Specify on
dialog
. This parameter is nontunable.
Source of the FFT length value. This parameter applies when you set
Method to Welch
and
Frequency resolution method to
Window length
. You can set this parameter
to:
Auto
(default) — The
block sets the FFT length to the frame size of the
input.
Property
— The block
sets the FFT length to the value you specify in
FFT length.
This parameter is nontunable.
Length of the FFT used to compute the spectrum estimates, specified as
a positive integer scalar. This parameter applies when you set
Method to Welch
,
Frequency resolution method to
Window length
, and FFT length
source to Property
. The
default is 1024
. This parameter is nontunable.
When you select this check box, the block sample rate is computed as N/T_{s}, where N is the frame size of the input signal and T_{s} is the sample time of the input signal.
This check box applies when you do one of the following:
Set Method to
Welch
and Frequency
resolution method to Window
length
.
Set Method to Filter
bank
and Frequency resolution
method to Number of frequency
bands
.
When you clear this check box, the block sample rate is the value you specify in Sample rate (Hz). By default, this check box is selected. This parameter is nontunable.
Sample rate of the input signal, specified as a positive scalar. The
default is 44100
. This parameter applies when you do
one of the following:
Set Frequency resolution method to
Auto
or
RBW
.
Set Method to
Welch
, Frequency
resolution method to Window
length
, and clear the Inherit
sample rate from input check box.
Set Method to Filter
bank
, Frequency resolution
method to Number of frequency
bands
, and clear the Inherit
sample rate from input check box.
This parameter is nontunable.
Window function the Welch algorithm uses, specified as one of
Chebyshev
 Flat
Top
 Hamming

Hann
 Kaiser
 Rectangular
. This parameter appears when
you set Method to Welch
.
The default is Hann
. This parameter is
nontunable.
Sidelobe attenuation of the window, specified as a real positive
scalar greater than or equal to 45
, in dB. The
default is 60
. This parameter appears when you set
Method to Welch
and
Window function to
Chebyshev
or
Kaiser
. This parameter is
nontunable.
Specify the averaging method as Running
or
Exponential
. In the running averaging
method, the block computes an equally weighted average of specified
number of spectrum estimates defined by 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, 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
.
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
.
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.
Percentage of overlap between successive data windows, specified as a
scalar from 0
and 100
. The default
value is 0
. To enable this parameter, on the
Main Tab, set Method to
Welch
. This parameter is
nontunable.
Load used as a reference to compute the power values, specified as a
real positive scalar expressed in ohms. The default value is
1
. This parameter is nontunable.
Frequency range of the spectrum estimator. You can set this parameter to:
Onesided
— The spectrum
estimator computes the onesided spectrum of a real input
signal. When the FFT length, NFFT
, is
even, the spectrum estimate has length
(NFFT
/2
) + 1
and is computed over the frequency range
[0 SampleRate/2]
.
SampleRate
is the sample rate of the
input signal. When NFFT
is odd, the
spectrum estimate has length
(NFFT
+ 1)/2
and is computed over the frequency range
[0 SampleRate/2
).
Twosided
— The spectrum
estimator computes the twosided spectrum of a complex or
real input signal. The length of the 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.
Centered
(default) — The
spectrum estimator computes the centered twosided spectrum
of a complex or real input signal. The length of the
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 the FFT length is odd.
This parameter is nontunable.
Units used to measure power. You can set this parameter to:
'Watts'
(default) — The spectrum
estimator measures power in watts.
'dBw'
— The spectrum estimator
measures power in decibelwatts.
'dBm'
— The spectrum estimator
measures power in decibelmilliwatts.
This parameter is nontunable.
When you select this check box, the block computes the maxhold spectrum of the input signal by keeping, at each frequency bin, the maximum value of all the power spectrum estimates. By default, this check box is not selected. This parameter is nontunable.
When you select this check box, the block computes the minhold spectrum of the input signal by keeping, at each frequency bin, the minimum value of all the power spectrum estimates. By default, this check box is not selected. This parameter is nontunable.
When you select this check box, the block outputs the frequency vector. By default, this check box is not selected. This parameter is nontunable.
When you select this check box, the block computes the effective resolution bandwidth. By default, this check box is not selected. This parameter is nontunable.
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
.
Estimate the Power Spectral Density (PSD) of a chirp signal using the Spectrum Estimator block. Compare the PSD data with a Bluetooth^{®} spectral mask and determine if the PSD data complies with the mask.
To view the complete model, enter ex_psd_spectralmask
in the
MATLAB command prompt.
Input Signal
The input to the Spectrum Estimator block is a chirp signal embedded in Gaussian noise
with zero mean and a variance of 0.01
. The chirp signal is amplified
with a gain factor in the range [0 1
].
Spectral Mask
The Spectral mask is created using the MATLAB Function block. The mask is based on the Bluetooth standard described in [5].
Live Processing
The Spectrum Estimator block estimates the PSD of the chirp. In this example, the PSD
data is compared with the spectral mask. The Display block shows a
1
or 0
, depending on whether the spectral data
is within the mask or not. During simulation, you can change the power in the input
signal by moving the slider in the Slider Gain block. Simultaneously, you
can view this change in the Array Plot block.
Port  Supported Data Types 

Input 

Output 

[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.
[5] Bluetooth Specification Version 4.2. Bluetooth SIG. December 2014, p. 217. Specification of the Bluetooth System