Package: dsp
Display frequency spectrum of timedomain signals
The SpectrumAnalyzer
object, referred to as
the scope, displays the frequency spectrum of timedomain signals.
This scope supports variablesize input, which allows the input frame
size to change. Frame size is the first dimension of the input vector.
The number of input channels must remain constant.
To display the spectra of signals in the Spectrum Analyzer:
Define and set up your Spectrum Analyzer. See Construction.
Call step
to display the frequency
spectrum of the signals in the Spectrum Analyzer figure. The number
of inputs to the step method must match the value of the NumInputPorts
property. The input to every
port must have same frame length, but can have a different number
of channels. Each input is an individual channel of input data. For
example, if the first input is a signal vector, it is Channel 1. If
the second input is a twocolumn matrix, it is Channel 2 and Channel
3.
Use the MATLAB^{®} clear
function
to close the Spectrum Analyzer figure window and clear its associated
data. Use the hide
method to hide the Spectrum
Analyzer window and the show
method to make it visible.
Use the MATLAB mcc
function
to compile code containing a Spectrum Analyzer.
Note: You cannot open Spectrum Analyzer configuration dialogs if you have more than one compiled component in your application. 
See the following sections for more information on the Spectrum Analyzer Graphical User Interface:
Note: For information about the Spectrum Analyzer block, see Spectrum Analyzer. 
Note:
If you own the MATLAB Coder™ product, you can generate C
or C++ code from MATLAB code in which an instance of this system
object is created. When you do so, the scope system object is automatically
declared as an extrinsic variable. In this
manner, you are able to see the scope display in the same way that
you would see a figure using the 
Note:
Starting in R2016b, instead of using the 
H = dsp.SpectrumAnalyzer
creates
a Spectrum Analyzer System object, H
. This object
displays the frequency spectrum of real and complexvalued floating
and fixedpoint signals.
H = dsp.SpectrumAnalyzer(ports)
creates
a Spectrum Analyzer with the specified number of input ports
.
This value is stored in the NumInputPorts
property.
H = dsp.SpectrumAnalyzer('
creates
a Spectrum Analyzer System object, Name
',Value
,...)H
, with each
specified property Name
set to the specified
value. You can specify Name
–Value
arguments
in any order.

Orientation of the spectrum and spectrogram Specify the layout type as one of This property is Tunable (Simulink). Default:  

Frequency over which frequency span is centered Specify as a real scalar the center frequency, in hertz, of
the frequency span over which the Spectrum Analyzer computes and plots
the spectrum. This property applies when you set the This property is Tunable (Simulink). Default:  

Channel names Specify as a cell array of character vectors the input channels
names to display in the legend, the Style dialog, and in some Measurements
panels. The channel names only appear in the legend when the This property is Tunable (Simulink).  

FFT length Specify as a positive, scalar integer the length of the FFT
that the Spectrum Analyzer uses to compute spectral estimates. This
property applies only when you set the This property is Tunable (Simulink). Default:  

Source of the FFT length value Specify the source of the FFT length value as one of
This property applies only when you set the
Default:  

Frequency offset Specify as a real, scalar value to apply the same frequency
offset, in Hertz, to all channels. To apply a specific frequency offset
for each channel, specify a vector of real, scalar values. The vector
length must be equal to number of input channels. The frequencyaxis
values are offset by the values specified in this property. The overall
span must fall within the Nyquist frequency
interval. When the This property is Tunable (Simulink). Default:  

Frequency resolution method Specify how to control the frequency resolution of the spectrum
analyzer as either In this case, the frequency resolution of the analyzer is defined
as
where NENBW is
the normalized effective noise bandwidth of the window currently specified
in the This property is Tunable (Simulink). Default:  

Frequency scale Specify the frequency scale as either This property is Tunable (Simulink). Default:  

Frequency span mode Specify the frequency span mode as one of
This property is Tunable (Simulink). Default:  

Caption to display on Spectrum Analyzer window Specify as a character vector the caption to display on the scope window. This property is Tunable (Simulink). Default:  

Number of input ports Number of input ports, specified as an integer. Each signal coming through an input port becomes a separate channel in the Spectrum Analyzer. Default:  

Overlap percentage Specify as a real, scalar value, the percentage overlap between the previous and current buffered data segments. The overlap creates a window segment that is used to compute a spectral estimate. The value must be greater than or equal to zero and less than 100. This property is Tunable (Simulink). Default:  

Two sided spectrum flag Set this property to When this property is Default:  

Maxhold trace flag Set this property to This property is Tunable (Simulink). See also: Default:  

Minhold trace flag Set this property to This property is Tunable (Simulink). See also: Default:  

Normal trace flag Set this property to This property is Tunable (Simulink). See also: Default:  

Plot type for normal traces Specify the type of plot to use for displaying normal traces
as either This property is Tunable (Simulink). Default:  

Spectrum Analyzer window position in pixels Specify, in pixels, the size and location of the scope window as a 4element double vector of the form [left bottom width height]. You can place the scope window in a specific position on your screen by modifying the values to this property. This property is Tunable (Simulink). Default: The default depends on your screen resolution. By default,
the Spectrum Analyzer window appears in the center of your screen
with a width of  

Resolution bandwidth Specify as a real, positive scalar the resolution bandwidth
(RBW), in hertz. RBW controls the spectral resolution of Spectrum
Analyzer. This property applies only when you set the This property is Tunable (Simulink). See also: Default:  

Source of resolution bandwidth value Specify the source of the resolution bandwidth (RBW) as either
This property is Tunable (Simulink). See also: Default:  

Reduce plot rate to improve performance When you set this property to Default:  

Reference load Specify as a real, positive scalar the load, in ohms, that the Spectrum Analyzer uses as a reference to compute power values. This property is Tunable (Simulink). Default:  

Sample rate of input Specify the sample rate, in hertz, of the input signals. The sample rate must be a finite numeric scalar. Default:  

Option to enable or disable grid display When you set this property to Default:  

Show or hide legend When you set this property to This property applies only when you set the Default:  

Sidelobe attenuation of window Specify as a real, positive scalar the window sidelobe attenuation,
in decibels (dB). This property applies only when you set the This property is Tunable (Simulink). Default:  

Frequency span over which spectrum is computed and plotted Specify as a real, positive scalar the frequency span, in hertz,
over which the Spectrum Analyzer computes and plots the spectrum.
This property applies only when you set the This property is Tunable (Simulink). Default:  

Number of spectral averages Specify as a positive, scalar integer the number of spectral
averages. This property applies only when you set the This property is Tunable (Simulink). Default:  

Spectral mask lines for a spectrum plot. Specify whether to display upper and lower spectral masks lines
on a spectrum plot. This property uses
All You can check the status of the spectral mask using a method or an event listener.
This example shows how to add a spectral mask to an existing sine = dsp.SineWave('Frequency',[98 100],'SampleRate',1000); sine.SamplesPerFrame = 1024; scope = dsp.SpectrumAnalyzer('SampleRate',sine.SampleRate, ... 'PlotAsTwoSidedSpectrum',false,'ShowLegend',true); for i=1:100 scope(sine() + 0.05*randn(1024,2)); end scope.SpectralMask.EnabledMasks = 'Upper and lower'; upperMask = [0 10; 90 10; 90 40; 110 40; 110 10; 500 10]; set(scope.SpectralMask,'UpperMask',upperMask,'LowerMask',60); res = getSpectralMaskStatus(scope) release(scope); res = struct with fields: IsCurrentlyPassing: 0 NumPassedTests: 8 NumTotalTests: 33 SuccessRate: 24.2424 FailingMasks: 'Lower' FailingChannels: 2 SimulationTime: 101.3760
Masks are overlaid on the spectrum. If the mask is green, the signal is passing. If the mask is red, the signal is failing. At the bottom of the window, the Mask success rate shows what percentage of the time the mask is succeeding. A tooltip gives you details about which mask is failing, how many times the mask failed, and which channels are causing the failure.  

Type of spectrum to show Specify the spectrum type as one of
This property is Tunable (Simulink). Default:  

Units of the spectrum Specify the units in which the Spectrum Analyzer
displays power values as either The available spectrum units depends on the value
of
This property is Tunable (Simulink). Default:  

Start frequency over which spectrum is computed Specify as a real scalar the start frequency, in hertz, over
which the Spectrum Analyzer computes and plots the spectrum. This
property applies only when you set the This property is Tunable (Simulink). Default:  

Stop frequency over which spectrum is computed Specify as a real scalar the stop frequency, in hertz, over
which the Spectrum Analyzer computes and plots the spectrum. This
property applies only when you set the This property is Tunable (Simulink). Default:  

Time resolution Specify the time resolution of each spectrogram line as a positive
scalar, expressed in seconds. This property applies when you set the The time resolution value is determined based on frequency resolution method, the RBW setting, and the time resolution setting.
This property is Tunable (Simulink). Default:  

Source of the time resolution value. Specify the source for the time resolution of each spectrogram
line as either This property is Tunable (Simulink). Default:  

Time span Specify the time span of the spectrogram display as a positive
scalar in seconds. This property applies when you set the This property is Tunable (Simulink). Default:  

Source of time span value Specify the source for the time span of the spectrogram as either This property is Tunable (Simulink). Default:  

Display title Specify the display title as a character vector. Enter Default:  

Viewer type Specify the spectrum type as one of
This property is Tunable (Simulink). Default:  

Window function Specify a window function for the spectral estimator as one of the options in the following table. For information on any window function, follow the link to the corresponding function reference in the Signal Processing Toolbox™ documentation.
This property is Tunable (Simulink). Default:  

The window length Control the frequency resolution by specifying the window length,
in samples used to compute the spectral estimates. The window length
must be an integer scalar greater than 2. This property applies only
when you set the This property is Tunable (Simulink). See also: Default:  

The label for the yaxis Specify the text for the scope to display to the left of the yaxis. Tunable (Simulink) This property applies only when you set the See also: Default:  

The limits for the yaxis Specify the yaxis limits as a 2element
numeric vector, This property applies only when you set the Default: 
getSpectralMaskStatus  Get test results of current spectral mask 
hide  Hide Spectrum Analyzer window 
reset  Reset internal states of Spectrum Analyzer object 
show  Make Spectrum Analyzer window visible 
step  Update spectrum in Spectrum Analyzer figure 
Common to All System Objects  

clone  Create System object with same property values 
getNumInputs  Expected number of inputs to a System object 
getNumOutputs  Expected number of outputs of a System object 
isLocked  Check locked states of a System object (logical) 
release  Allow System object property value changes 
View a onesided power spectrum made from the sum of fixe real sine waves with different amplitudes and frequencies.
Fs = 100e6; % Sampling frequency fSz = 5000; % Frame size sin1 = dsp.SineWave(1e0, 5e6,0,'SamplesPerFrame',fSz,'SampleRate',Fs); sin2 = dsp.SineWave(1e1,15e6,0,'SamplesPerFrame',fSz,'SampleRate',Fs); sin3 = dsp.SineWave(1e2,25e6,0,'SamplesPerFrame',fSz,'SampleRate',Fs); sin4 = dsp.SineWave(1e3,35e6,0,'SamplesPerFrame',fSz,'SampleRate',Fs); sin5 = dsp.SineWave(1e4,45e6,0,'SamplesPerFrame',fSz,'SampleRate',Fs); scope = dsp.SpectrumAnalyzer; scope.SampleRate = Fs; scope.SpectralAverages = 1; scope.PlotAsTwoSidedSpectrum = false; scope.RBWSource = 'Auto'; scope.PowerUnits = 'dBW'; for idx = 1:1e2 y1 = sin1(); y2 = sin2(); y3 = sin3(); y4 = sin4(); y5 = sin5(); scope(y1+y2+y3+y4+y5+0.0001*randn(fSz,1)); end
Run the release
method to let property values and input characteristics change. The scope automatically scales the axes.
release(scope)
Run the clear
function to close the Spectrum Analyzer window.
clear('scope');
This example shows the spectrogram for a chirp signal with added random noise.
Fs = 233e3; frameSize = 20e3; chirp = dsp.Chirp('SampleRate',Fs,... 'SamplesPerFrame',frameSize,... 'InitialFrequency',11e3,... 'TargetFrequency',11e3+55e3); scope = dsp.SpectrumAnalyzer('SampleRate',Fs); scope.SpectrumType = 'Spectrogram'; scope.RBWSource = 'Property'; scope.RBW = 500; scope.TimeSpanSource = 'Property'; scope.TimeSpan = 2; scope.PlotAsTwoSidedSpectrum = false; for idx = 1:50 y = chirp()+ 0.05*randn(frameSize,1); scope(y); end release(scope)
View a twosided power spectrum of a sine wave with noise on the Spectrum Analyzer.
sin = dsp.SineWave('Frequency',100,'SampleRate',1000); sin.SamplesPerFrame = 1000; scope = dsp.SpectrumAnalyzer('SampleRate',sin.SampleRate); for ii = 1:250 x = sin() + 0.05*randn(1000,1); scope(x); end
Run the release
method to change property values and input characteristics. The scope automatically scales the axes. It updates the display one more time if any data is in the internal buffer.
release(scope);
Run the MATLAB clear
function to close the Spectrum Analyzer window.
clear('scope');
The Spectrum Analyzer indicates the spectrum computation settings that are represented in the current display. Check the Resolution Bandwidth, Time Resolution, and Offset indicators in the scope status bar for this information. The values specified by these indicators may be changed by modifying parameters in the Spectrum Settings panel. You can also view the object state and the amount of time data that correspond to the current display. Check the Simulation status and Display time indicators for this information. The following figure highlights these aspects of the Spectrum Analyzer window.
Resolution Bandwidth — The smallest positive frequency or frequency interval that can be resolved.
Time Resolution — The time resolution for a spectrogram line.
Offset — The constant frequency offset to apply to the entire spectrum or a vector of frequency offsets to apply to each spectrum for multiple inputs.
Simulation Status — Provides the current status of the model simulation.
Display time — The amount of time that has progressed since the last update to the Spectrum Analyzer display.
Frequency span — The range of values shown on the frequencyaxis on the Spectrum Analyzer window.
For more information, see Spectrum Settings.
By default, Spectrum Analyzer updates the display at fixed intervals of time at a rate not exceeding 20 hertz. If you want Spectrum Analyzer to plot a spectrum on every simulation time step, you can disable the Reduce Plot Rate to Improve Performance option. In the Spectrum Analyzer menu, select Simulation > Reduce Plot Rate to Improve Performance to clear the check box. Tunable (Simulink).
Note: When this check box is selected, Spectrum Analyzer may display a misleading spectrum in some situations. For example, if the input signal is wideband with nonstationary behavior, such as a chirp signal, Spectrum Analyzer might display a stationary spectrum. The reason for this behavior is that Spectrum Analyzer buffers the input signal data and only updates the display periodically at approximately 20 times per second. Therefore, Spectrum Analyzer does not render changes to the spectrum that occur and elapse between updates, which gives the impression of an incorrect spectrum. To ensure that spectral estimates are as accurate as possible, clear the Reduce Plot Rate to Improve Performance check box. When you clear this box, Spectrum Analyzer calculates spectra whenever there is enough data, rendering results correctly. 
The Spectrum Settings panel appears at the right side of the Spectrum Analyzer figure. This panel enables you to modify settings to control the manner in which the spectrum is calculated. You can choose to hide or display the Spectrum Settings panel. In the Spectrum Analyzer menu, select View > Spectrum Settings. Alternatively, in the Spectrum Analyzer toolbar, select the Spectrum Settings button.
The Spectrum Settings panel is separated into four expandable panes, labeled Main options, Spectrogram options, Window options, and Trace options.
The Main Options pane enables you to modify or view the main options.
Type — The type of spectrum to display. Tunable (Simulink)
Power
— power spectrum
Power density
—
power spectral density, the magnitude of the spectrum normalized to
a bandwidth of 1 hertz
RMS
— root mean
squared of the spectrum
View — The spectrum view to display. Tunable (Simulink)
Spectrum
— frequency
spectrum
Spectrogram
— frequency
spectrum over time. The most recent spectrogram update is at the bottom
of the display and time scrolls from the bottom to the top of the
display.
Spectrum and spectrogram
—
duel view of spectrum and spectrogram.
Sample rate (Hz) — The sample rate, in hertz, of the input signals. Tunable (Simulink)
Full frequency span — Compute and plot the spectrum over the entire Nyquist frequency interval.
By default, when the Twosided spectrum check box is also enabled, the Nyquist interval is $$\left[\frac{SampleRate}{2},\frac{SampleRate}{2}\right]+FrequencyOffset$$ hertz. If you clear the Twosided spectrum check box, the Nyquist interval is$$\left[0,\frac{SampleRate}{2}\right]+FrequencyOffset$$ hertz.
Enabling this check box is equivalent to setting the FrequencySpan
property to 'Full'
.
.
Span (Hz) and CF (Hz), or FStart (Hz) and FStop (Hz) — When Span (Hz) is showing in the Main Options pane, you define the range of values shown on the frequencyaxis on the Spectrum Analyzer window using frequency span and center frequency. From the dropdown list, select FStart (Hz) to define the range of frequencyaxis values using start frequency and stop frequency instead.
Span (Hz) — The frequency
span, in hertz. This parameter defines the range of values shown on
the frequencyaxis on the Spectrum Analyzer window.
When this parameter is set to a numeric value, then it is equivalent
to the Span
property when the FrequencySpan
property is set to 'Span
and Center Frequency'
. Tunable (Simulink).
CF (Hz) — The center frequency,
in hertz. This parameter defines the value shown at the middle point
of the frequencyaxis on the Spectrum Analyzer
window. This parameter is equivalent to the CenterFrequency
property when the FrequencySpan
property is set to 'Span
and Center Frequency'
. Tunable (Simulink).
FStart (Hz) — The start
frequency, in hertz. This parameter defines the value shown at the
leftmost side of the frequencyaxis on the Spectrum
Analyzer window. This parameter is equivalent to the StartFrequency
property
when the FrequencySpan
property is
set to 'Start and stop frequencies'
. Tunable (Simulink).
FStop (Hz) — The stop
frequency, in hertz. The parameter defines the value shown at the
rightmost side of the frequencyaxis on the Spectrum
Analyzer window. This parameter is equivalent to the StopFrequency
property when the FrequencySpan
property is set to 'Start
and stop frequencies'
. Tunable (Simulink).
RBW (Hz) / Window length — The frequency resolution method.
If set to RBW (Hz), the resolution bandwidth,
in hertz. This parameter defines the smallest positive frequency that
can be resolved. By default, this parameter is set to Auto
.
In this case, the Spectrum Analyzer determines the appropriate value
to ensure that there are 1024 RBW intervals over
the specified Frequency span. This case is equivalent
to when you set the RBWSource
property
to 'Auto'
.
If you set this parameter to a numeric value, then you must
specify a value that ensures there are at least two RBW intervals
over the specified frequency span. In other words, the ratio of the
overall span to RBW must be at least two: $$\frac{span}{RBW}>2$$.
In this case, this parameter is equivalent to the RBW
property, when RBWSource
is
set to 'Property'
.
If set to Window length, the length of the window, in samples, to compute the spectral estimates. The window length must be an integer scalar greater than 2.
. Tunable (Simulink).
NFFT — The number of Fast
Fourier Transform (FFT) points. This parameter is available only when
the frequency resolution method is Window length.
This parameter defines the length of the FFT that Spectrum Analyzer
uses to compute spectral estimates. Acceptable options are Auto
or
a positive, scalar integer. The NFFT (FFTLength
) value must be greater than or
equal to the WindowLength
. By default,
when NFFT is set to Auto
,
Spectrum Analyzer sets the number of FFT points to the window length
or 1024, whichever is larger. This case is equivalent to when you
set the FFTLengthSource
property to 'Auto'
.
When this parameter is set to a positive integer, this parameter
is equivalent to the n
parameter that you can set
when you run the MATLAB fft
function.
In this case, this parameter is also equivalent to FFTLength
when
you set FFTLengthSource
to 'Property'
. Tunable (Simulink).
Samples/update — The number of input samples required to compute one spectral update. You cannot modify this parameter; it is shown here for display purposes only. This parameter is directly related to RBW by the following equation: $${N}_{samples}=\frac{\left(1\frac{{O}_{p}}{100}\right)\times NENBW\times {F}_{s}}{RBW}$$ or to the window length by this equation: . NENBW is the normalized effective noise bandwidth, a factor of the windowing method used, which is shown in the Window Options pane. F_{s} is the sample rate. If the number of samples provided in the input are not sufficient to achieve the resolution bandwidth that you specify, Spectrum Analyzer produces a message on the display as shown in the following figure.
The Spectrogram options pane contains options
for modifying the spectrogram. These options only display when the Type is Spectrogram
or Spectrum
and spectrogram
Channel — Select the signal channel for which the spectrogram settings apply. This option displays only if there is more than one signal channel input.
Time res. (s) — The time
resolution, in seconds. This parameter is available only in spectrogram
mode. Time resolution is the amount of data,
in seconds, used to compute a spectrogram line. The minimum
attainable resolution is the amount of time required to
compute a single spectral estimate. The tooltip displays the minimum
attainable resolution based on the current settings. You can get or
set the minimum attainable resolution value from the TimeResolution
property. Tunable (Simulink).
Time span (s) — The time
span over which the Spectrum Analyzer displays the spectrogram, in
seconds. This parameter is available only in spectrogram mode. The time
span is the product of the number of spectral lines you
want and the time resolution. The tooltip displays the minimum allowable
time span, given the current settings. If the time span is set to Auto
,
100 spectral lines are used. This parameter is equivalent to the TimeSpan
property. Tunable (Simulink).
The Window Options pane enables you to modify the window options.
Overlap (%) — The segment
overlap percentage. This parameter defines the amount of overlap between
the previous and current buffered data segments. The value must be
greater than or equal to zero and less than 100. This parameter is
equivalent to the OverlapPercent
property. Tunable (Simulink).
Window — The windowing
method to apply to the spectrum. Windowing is used to control the
effect of sidelobes in spectral estimation. The window you specify
affects the segment length required to achieve a resolution bandwidth
and the required number of samples per update. For more information
about windowing, see the Window Function block.
This parameter is equivalent to the Window
property. Tunable (Simulink).
Attenuation (dB) — The
sidelobe attenuation, in decibels (dB). This property applies only
when you set the Window parameter to Chebyshev
or Kaiser
.
You must specify a value greater than or equal to 45
.
If you use a Chebyshev window and set the sidelobe attenuation to
less than 35 dB, the desired resolution bandwidth may not be achieved.
This parameter is equivalent to the SidelobeAttenuation
property. Tunable (Simulink).
NENBW — Normalized Effective Noise Bandwidth of the window. You cannot modify this parameter; it is a readout shown here for display purposes only. This parameter is a measure of the noise performance of the window. It is the width of a rectangular filter that accumulates the same noise power with the same peak power gain. NENBW can be calculated from the windowing function using the following equation: . The rectangular window has the smallest NENBW, with a value of 1. All other windows have a larger NENBW value. For example, the Hann window has an NENBW value of approximately 1.5.
The Trace Options pane enables you to modify the trace options.
Units — The units of the
spectrum. The available values depends on the value of Type.
Available options include dBm
, dBW
, Watts
, Vrms
,
and dBV
. This parameter is equivalent to
the SpectrumUnits
property. Tunable (Simulink).
Averages — Specify as
a positive, scalar integer the number of spectral averages. This parameter
applies only when the Spectrum View is Spectrum
or Spectrum
and spectrogram
. Spectrum Analyzer computes the current
power spectrum estimate by averaging the last N power
spectrum estimates. This property defines the number of spectral averages, N.
This parameter is equivalent to the SpectralAverages
property. Tunable (Simulink).
Reference load — The reference
load, in ohms, used to scale the spectrum. Specify as a real, positive
scalar the load, in ohms, that the Spectrum Analyzer uses as a reference
to compute power values. This parameter is equivalent to the ReferenceLoad
property. Tunable (Simulink).
Scale — Linear or logarithmic
scale. When the frequency span contains negative frequency values,
Spectrum Analyzer disables the logarithmic option. This parameter
is equivalent to the FrequencyScale
property. Tunable (Simulink).
Offset — The constant
frequency offset to apply to the entire spectrum or a vector of frequencies
to apply to each spectrum for multiple inputs. The constant offset
parameter is added to the values on the frequencyaxis
in the Spectrum Analyzer window. It is not used in any spectral computations.
You must take this parameter into consideration when you set the Span
(Hz) and CF (Hz) parameters to ensure
that the frequency span is within Nyquist limits. The Nyquist interval
is $$\left[\frac{SampleRate}{2},\frac{SampleRate}{2}\right]+FrequencyOffset$$ hertz
if Twosided spectrum is selected, and $$\left[0,\frac{SampleRate}{2}\right]+FrequencyOffset$$ hertz
otherwise. This parameter is equivalent to the FrequencyOffset
property.
Normal trace — Normal
trace view. This parameter applies only when the Spectrum View is Spectrum
or Spectrum
and spectrogram
. By default, when this check box is
enabled, Spectrum Analyzer calculates and plots the power spectrum
or power spectrum density computed by the Welch estimator.
The Welch estimator performs a smoothing operation by averaging a
number of spectral estimates. To clear this check box, you must first
select either the Max hold trace or the Min
hold trace check box. This parameter is equivalent to the PlotNormalTrace
property. Tunable (Simulink).
Max hold trace — Maximum
hold trace view. This parameter applies only when the Spectrum View is Spectrum
or Spectrum
and spectrogram
. Select this check box to enable Spectrum
Analyzer to plot the maximum spectral values of all the estimates
obtained. This parameter is equivalent to the PlotMaxHoldTrace
property. Tunable (Simulink).
Min hold trace — Minimum
hold trace view. This parameter applies only when the Spectrum View is Spectrum
or Spectrum
and spectrogram
. Select this check box to enable Spectrum
Analyzer to plot the minimum spectral values of all the estimates
obtained. This parameter is equivalent to the PlotMinHoldTrace
property. Tunable (Simulink).
Twosided spectrum — Select this check box to enable twosided spectrum view. In this view, both negative and positive frequencies are shown. If you clear this check box, Spectrum Analyzer shows a onesided spectrum with only positive frequencies. Spectrum Analyzer requires that this parameter is selected when the input signal is complexvalued. When your signal includes DC input, you should display a twosided spectrum to resolve low frequency power and DC power. This parameter is equivalent to the property.
The Measurements panels are the panels that appear to the right side of the Spectrum Analyzer figure.
Note:
When View is 
When you use the scope to view multiple signals, the Trace Selection panel appears if you have more than one signal displayed and you click any of the other Measurements panels. The Measurements panels display information about only the signal chosen in this panel. Choose the signal name for which you would like to display time domain measurements. See the following figure.
You can choose to hide or display the Trace Selection panel. In the Scope menu, select Tools > Measurements > Trace Selection.
The Cursor Measurements panel displays screen cursors. The panel provides two types of cursors for measuring signals. Waveform cursors are vertical cursors that track along the signal. Screen cursors are both horizontal and vertical cursors that you can place anywhere in the display.
Note: If a data point in your signal has more than one value, the cursor measurement at that point is undefined and no cursor value is displayed. 
In the Scope menu, select Tools > Measurements > Cursor Measurements. Alternatively, in the Scope toolbar, click the Cursor Measurements button.
The Cursor Measurements panel appears as follows for the spectrum and dual view.
The Cursor Measurements panel appears as follows for the spectrogram view. You must pause the spectrogram display before you can use cursors.
The Cursor Measurements panel is separated into two panes, labeled Settings and Measurements. You can expand each pane to see the available options.
You can use the mouse or the left and right arrow keys to move vertical or waveform cursors and the up and down arrow keys for horizontal cursors.
The Settings pane enables you to modify the type of screen cursors used for calculating measurements. When more than one signal is displayed, you can assign cursors to each trace individually.
Screen Cursors — Shows screen cursors (for spectrum and dual view only).
Horizontal — Shows horizontal screen cursors (for spectrum and dual view only).
Vertical — Shows vertical screen cursors (for spectrum and dual view only).
Waveform Cursors — Shows cursors that attach to the input signals (for spectrum and dual view only).
Lock Cursor Spacing — Locks the frequency difference between the two cursors.
Snap to Data — Positions the cursors on signal data points.
The Peak Finder panel displays the maxima, showing the xaxis values at which they occur. Peaks are defined as a local maximum where lower values are present on both sides of a peak. Endpoints are not considered to be peaks. This panel allows you to modify the settings for peak threshold, maximum number of peaks, and peak excursion. You can choose to hide or display the Peak Finder panel. In the scope menu, select Tools > Measurements > Peak Finder. Alternatively, in the scope toolbar, select the Peak Finder button.
The Peak finder panel is separated into two panes, labeled Settings and Peaks. You can expand each pane to see the available options.
The Settings pane enables you to modify
the parameters used to calculate the peak values within the displayed
portion of the input signal. For more information on the algorithms
this pane uses, see the Signal Processing Toolbox findpeaks
function
reference.
Peak Threshold — The level
above which peaks are detected. This setting is equivalent to the MINPEAKHEIGHT
parameter,
which you can set when you run the findpeaks
function.
Max Num of Peaks — The
maximum number of peaks to show. The value you enter must be a scalar
integer from 1 through 99. This setting is equivalent to the NPEAKS
parameter,
which you can set when you run the findpeaks
function.
Min Peaks Distance — The
minimum number of samples between adjacent peaks. This setting is
equivalent to the MINPEAKDISTANCE
parameter,
which you can set when you run the findpeaks
function.
Peak Excursion — The minimum
height difference between a peak and its neighboring samples The peak
excursion setting is equivalent to the THRESHOLD
parameter,
which you can set when you run the findpeaks
function.
Label Format — The coordinates to display next to the calculated peak values on the plot. To see peak values, expand the Peaks pane and select the check boxes associated with individual peaks of interest. By default, both xaxis and yaxis values are displayed on the plot. Select which axes values you want to display next to each peak symbol on the display.
X+Y
— Display both xaxis
and yaxis values.
X
— Display only xaxis
values.
Y
— Display only yaxis
values.
The Peaks pane displays all of the largest calculated peak values. It also shows the coordinates at which the peaks occur, using the parameters you define in the Settings pane. You set the Max Num of Peaks parameter to specify the number of peaks shown in the list.
The numerical values displayed in the Value column
are equivalent to the pks
output argument returned
when you run the findpeaks
function. The numerical
values displayed in the second column are similar to the locs
output
argument returned when you run the findpeaks
function.
The Peak Finder displays the peak values in the Peaks pane. By default, the Peak Finder panel displays the largest calculated peak values in the Peaks pane in decreasing order of peak height. Use the sort descending button ( ) to rearrange the category and order by which Peak Finder displays peak values. Click this button again to sort the peaks in ascending order instead. When you do so, the arrow changes direction to become the sort ascending button ( ). A filled sort button indicates that the peak values are currently sorted in the direction of the button arrow. If the sort button is not filled ( ), then the peak values are sorted in the opposite direction of the button arrow. The Max Num of Peaks parameter still controls the number of peaks listed.
Use the check boxes to control which peak values are shown on the display. By default, all check boxes are cleared and the Peak Finder panel hides all the peak values. To show all the peak values on the display, select the check box in the topleft corner of the Peaks pane. To hide all the peak values on the display, clear this check box. To show an individual peak, select the check box directly to the left of its Value listing. To hide an individual peak, clear the check box directly to the left of its Value listing.
The Peaks are valid for any units of the input signal. The letter after the value associated with each measurement indicates the abbreviation for the appropriate International System of Units (SI) prefix, such as m for milli. For example, if the input signal is measured in volts, an m next to a measurement value indicates that this value is in units of millivolts.
The Channel Measurements panel displays occupied bandwidth or adjacent channel power ratio (ACPR) measurements. You can choose to hide or display this pane in the Scope menu by selecting Tools > Measurements > Channel Measurements. Alternatively, in the Scope toolbar, click the Cursor Measurements button.
In addition to the measurements, the Channel Measurements panel has an expandable Channel Settings pane.
Measurement — The type
of measurement data to display. Available options are Occupied
BW
or ACPR
. See Algorithms for information on how Occupied
BW is calculated. ACPR is the adjacent channel power ratio, which
is the ratio of the main channel power to the adjacent channel power.
When you select Occupied BW
as
the Measurement, the following fields appear.
Channel Settings — Enables you to modify the parameters for calculating the channel measurements.
Channel Power — The total power in the channel.
Occupied BW — The bandwidth
containing the specified Occupied BW (%) of
the total power of the spectrum. This setting is available only if
you select Occupied BW
as the Measurement type.
Frequency Error — The
difference between the center of the occupied band and the center
frequency (CF) of the channel. This setting is
available only if you select Occupied BW
as
the Measurement type.
When you select ACPR
as
the Measurement, the following fields appear.
Channel Settings — Enables you to modify the parameters for calculating the channel measurements.
Channel Power — The total power in the channel.
Offset (Hz) — The center
frequency of the adjacent channel with respect to the center frequency
of the main channel. This setting is available only if you select ACPR
as
the Measurement type.
Lower (dBc) — The power
ratio of the lower sideband to the main channel. This setting is available
only if you select ACPR
as the Measurement type.
Upper (dBc) — The power
ratio of the upper sideband to the main channel. This setting is available
only if you select ACPR
as the Measurement type.
The Distortion Measurements panel displays harmonic distortion and intermodulation distortion measurements. You can choose to hide or display this panel in the Scope menu by selecting Tools > Measurements > Distortion Measurements. Alternatively, in the Scope toolbar, click the Distortion Measurements button.
The Distortion Measurements panel has an expandable Harmonics pane, which shows measurement results for the specified number of harmonics.
Note:
For an accurate measurement, ensure that the fundamental signal
(for harmonics) or primary tones (for intermodulation) is larger than
any spurious or harmonic content. To do so, you may need to adjust
the resolution bandwidth ( 
Distortion — The type
of distortion measurements to display. Available options are Harmonic
or Intermodulation
.
Select Harmonic
if your system input is
a single sinusoid. Select Intermodulation
if
your system input is two equal amplitude sinusoids. Intermodulation
can help you determine distortion when only a small portion of the
available bandwidth will be used.
See Algorithms for information on how distortion measurements are calculated.
When you select Harmonic
as
the Distortion, the following fields appear.
The harmonic distortion measurement automatically locates the largest sinusoidal component (fundamental signal frequency). It then computes the harmonic frequencies and power in each harmonic in your signal. Any DC component is ignored. Any harmonics that are outside the spectrum analyzer's frequency span are not included in the measurements. Adjust your frequency span so that it includes all the desired harmonics.
Note: To best view the harmonics, make sure that your fundamental frequency is set high enough to resolve the harmonics. However, this frequency should not be so high that aliasing occurs. For the best display of harmonic distortion, your plot should not show skirts, which indicate frequency leakage. Additionally, the noise floor should be visible. For a better display, try a Kaiser window with a large sidelobe attenuation (e.g. between 100–300 db).

Num. Harmonics — Number
of harmonics to display, including the fundamental frequency. Valid
values of Num. Harmonics are from 2
to 99
.
The default value is 6
.
Label Harmonics — Select Label Harmonics to add numerical labels to each harmonic in the spectrum display.
1 — The fundamental frequency, in hertz, and its power, in decibels of the measured power referenced to one milliwatt (dBm).
2, 3, ... — The harmonics frequencies, in hertz, and their power in decibels relative to the carrier (dBc). If the harmonics are at the same level or exceed the fundamental frequency, reduce the input power.
THD — The total harmonic distortion. This value represents the ratio of the power in the harmonics, D, to the power in the fundamental frequency, S. If the noise power is too high in relation to the harmonics, the THD value is not accurate. In this case, lower the resolution bandwidth or select a different spectral window. THD = 10log_{10}(D/S).
SNR — Signaltonoise ratio (SNR). This value represents the ratio of power in the fundamental frequency, S, to the power of all nonharmonic content, N, including spurious signals, in decibels relative to the carrier (dBc). SNR = 10log_{10}(S/N). If you see – – as the reported SNR, your signal's total nonharmonic content is less than 30% of the total signal.
SINAD — Signaltonoiseanddistortion. This value represents the ratio of the power in the fundamental frequency, S to all other content (including noise, N, and harmonic distortion, D), in decibels relative to the carrier (dBc). SINAD = 10log_{10}(S/(N+D).
SFDR — Spurious free dynamic range (SFDR). This value represents the ratio of the power in the fundamental frequency, S, to power of the largest spurious signal, R, regardless of where it falls in the frequency spectrum. The worst spurious signal may or may not be a harmonic of the original signal. SFDR represents the smallest value of a signal that can be distinguished from a large interfering signal. SFDR includes harmonics. SFDR = 10log_{10}(S/R).
When you select Intermodulation
as
the Distortion, the following fields appear.
The intermodulation distortion measurement automatically locates the fundamental, firstorder frequencies (F1 and F2). It then computes the frequencies of the thirdorder intermodulation products (2*F1F2 and 2*F2F1).
Label frequencies — Select Label frequencies to add numerical labels to the firstorder intermodulation product and thirdorder frequencies in the spectrum analyzer display.
F1 — Lower fundamental firstorder frequency
F2 — Upper fundamental firstorder frequency
2F1  F2 — Lower intermodulation product from thirdorder harmonics
2F2  F1 — Upper intermodulation product from thirdorder harmonics
TOI — Thirdorder intercept point. If the noise power is too high in relation to the harmonics, the TOI value will not be accurate. In this case, you should lower the resolution bandwidth or select a different spectral window. If the TOI has the same amplitude as the input twotone signal, reduce the power of that input signal.
The CCDF Measurements panel displays complimentary cumulative distribution function measurements. CCDF measurements in this scope show the probability of a signal's instantaneous power being a specified level above the signal's average power. These measurements are useful indicators of a signal's dynamic range.
To compute the CCDF measurements, each input sample is quantized to 0.01 dB increments. Using a histogram 100 dB wide (10,000 points at 0.01 dB increments), the largest peak encountered is placed in the last bin of the histogram. If a new peak is encountered, the histogram shifts to make room for that new peak.
You can choose to hide or display this panel in the Scope menu by selecting Tools > Measurements > CCDF Measurements. Alternatively, in the Scope toolbar, click the CCDF Measurements button.
Plot Gaussian reference — Select Plot Gaussian reference to show the Gaussian white noise reference signal on the plot.
Probability (%) — The percentage of the signal that contains the power level above the value listed in the dB above average column
dB above average — The expected minimum power level at the associated Probability (%).
Average Power — The average power level of the signal since the start of simulation or from the last reset.
Max Power — The maximum power level of the signal since the start of simulation or from the last reset.
PAPR — The ratio of the peak power to the average power of the signal. PAPR should be less that 100 dB to obtain accurate CCDF measurements. If PAPR is above 100 dB, only the highest 100 dB power levels are plotted in the display and shown in the distribution table.
Sample Count — The total number of samples used to compute the CCDF.
Reset — Clear all current CCDF measurements and restart.
The Visuals—Spectrum Properties dialog box controls the visual configuration settings of the Spectrum Analyzer display. From the Spectrum Analyzer menu, select View > Configuration Properties to open this dialog box. Alternatively, in the Spectrum Analyzer toolbar, click the Configuration Properties button.
When the Spectrum View is Spectrum
,
the Display pane of the Visuals—Spectrum
Properties dialog box appears as follows:
When the Spectrum View is Spectrogram
the Display pane
of the Visuals—Spectrum Properties dialog box appears as follows:
When the Spectrum View is Spectrum
or spectroogram
the Display pane
of the Visuals—Spectrum Properties dialog box appears as follows:
Specify the display title as a character vector. Enter %<SignalLabel>
to
use the signal labels in the Simulink Model as the axes titles. This
property is Tunable (Simulink).
By default, the display has no title.
Select this check box to show the legend in the display. The channel legend displays a name for each channel of each input signal. When the legend appears, you can place it anywhere inside of the scope window. To turn off the legend, clear the Show legend check box.
You can edit the name of any channel in the legend by doubleclicking the current name and entering a new channel name. By default, if the signal has multiple channels, the scope uses an index number to identify each channel of that signal. To change the appearance of any channel of any input signal in the scope window, from the scope menu, select View > Style.
The legend lets you modify what signals are shown. To show only one signal, click the signal name. To toggle a signal on/off, rightclick the signal name.
This parameter applies only
when the View Type is Spectrum
or Spectrum
and spectrogram
. Tunable (Simulink)
When you select this check box, a grid appears in the display of the scope figure. To hide the grid, clear this check box. Tunable (Simulink)
Specify the minimum value of the yaxis. Tunable (Simulink)
Specify the maximum value of the yaxis. Tunable (Simulink)
Specify the text for the scope to display to the left of the yaxis.
Regardless of this property, Spectrum Analyzer always displays power
units after this text as one of 'dBm'
, 'dBW'
, 'Watts'
, 'dBm/Hz'
, 'dBW/Hz'
, 'Watts/Hz'
, Vrms
,
or dBV
Tunable (Simulink).
Select the color map for the spectrogram, or enter a 3column
matrix expression for the color map. See colormap
for
information. Tunable (Simulink).
Set the signal power for the minimum color value of the spectrogram. Tunable (Simulink).
Set the signal power for the maximum color value of the spectrogram. Tunable (Simulink).
In the Style dialog box, you can customize the style of spectrum display. This dialog box is not available for the spectrogram view. You are able to change the color of the figure, the background and foreground colors of the axes, and properties of the lines. From the Spectrum Analyzer menu, select View > Style to open this dialog box.
The Style dialog box allows you to modify the following properties of the Spectrum Analyzer figure:
Specify the color that you want to apply to the background of the scope figure. By default, the figure color is gray.
Specify whether to display a Line
or Stem
plot.
Specify the color that you want to apply to the background of the axes.
Specify the channel for which you want to modify the visibility, line properties, and marker properties.
Specify whether the selected channel should be visible. If you clear this check box, the line disappears.
Specify the line style, line width, and line color for the selected channel.
Specify marks for the selected channel to show at its data points.
This parameter is similar to the Marker
property
for plot objects. You can choose any of the marker symbols from the
dropdown.
The Tools—Axes Scaling Properties dialog box allows you to zoom in on and zoom out of your data automatically. You can also scale the axes of the Spectrum Analyzer. In the Spectrum Analyzer menu, select Tools > Scaling Properties to open this dialog box.
For the spectrum view, the Tools—Axes Scaling Properties dialog box appears as:
For spectrogram view, the Tools—Axes Scaling Properties dialog box appears as:
For dual view, the Tools—Axes Scaling Properties dialog box appears as:
Note: The Xaxis scaling options only apply when using CCDF measurements. 
Specify when the scope automatically scales the axes. If the spectrogram is displayed, specify when the scope automatically scales the color. You can select one of the following options:
Manual
— When you
select this option, the scope does not automatically scale the axes
or color. You can manually scale the axes or color in any of the following
ways:
Select Tools > Scaling Properties.
Press one of the Scale Axis Limits toolbar buttons.
When the scope figure is the active window, press Ctrl and A simultaneously.
Auto
— When you
select this option, the scope scales the axes or color as needed,
both during and after simulation. Selecting this option shows the Do
not allow Yaxis limits to shrink or Do not allow
color limits to shrink .
After N Updates
—
Selecting this option causes the scope to scale the axes or color
after a specified number of updates. This option is useful and more
efficient when your scope display starts with one axis scale, but
quickly reaches a different steady state axis scale. Selecting this
option shows the Number of updates edit box.
By default, this parameter is set to Auto
,
and the scope does not shrink the yaxis limits
when scaling the axes or color. Tunable (Simulink).
When you select this property, the yaxis are allowed to grow during axes scaling operations. If the spectrogram is displayed, selecting this property allows the color limits to grow during axis scaling. If you clear this check box, the yaxis or color limits can shrink during axes scaling operations.
This property appears only when you select Auto
for
the Axis scaling or Color scaling property.
When you set the Axes scaling or Color
scaling property to Manual
or After
N Updates
, the yaxis or color limits
can shrink. Tunable (Simulink).
Specify as a positive integer the number of updates after which
to scale the axes. If the spectrogram is displayed, this property
specifies the number of updates after which to scale the color. This
property appears only when you select After N Updates
for
the Axes scaling or Color scaling property. Tunable (Simulink).
Select this check box to scale the axes when the simulation stops. If the spectrogram is displayed, select this check box to scale the color when the simulation stops. The yaxis is always scaled. The xaxis limits are only scaled if you also select the Scale Xaxis limits check box.
Set the percentage of the yaxis that the
scope uses to display the data when scaling the axes. If the spectrogram
is displayed, set the percentage of the power values range within
the colormap. Valid values are from 1 through 100. For example, if
you set this property to 100
, the Scope scales
the yaxis limits such that your data uses the
entire yaxis range. If you then set this property
to 30
, the scope increases the yaxis
range or color such that your data uses only 30% of the yaxis
range or color. Tunable (Simulink).
Specify where the scope aligns your data along the yaxis
when it scales the axes. If the spectrogram is displayed, specify
where the scope aligns your data along the yaxis
when it scales the color. You can select Top
, Center
,
or Bottom
. Tunable (Simulink).
Check this box to allow the scope to scale the xaxis
limits when it scales the axes. If Axes scaling is
set to Auto
, checking Autoscale
Xaxis limits only scales the data currently within the
axes, not the entire signal in the data buffer. If Autoscale
Xaxis limits is on and the resulting axis is greater than
the span of the scope, trigger position markers will not be displayed.
Triggers are controlled using the Trigger Measurements panel. Tunable (Simulink).
Set the percentage of the xaxis that the
scope uses to display the data when scaling the axes. Valid values
are from 1 through 100. For example, if you set this property to 100
,
the scope scales the xaxis limits such that your
data uses the entirexaxis range. If you then set
this property to 30
, the scope increases the xaxis
range such that your data uses only 30% of the xaxis
range. Use the xaxis Align property
to specify data placement along the xaxis.
This property appears only when you select the Scale Xaxis limits check box. Tunable (Simulink).
Specify how the scope aligns your data along the xaxis: Left
, Center
,
or Right
. This property appears only when
you select the Scale Xaxis limits check box. Tunable (Simulink).
Spectrum Analyzer uses the RBW
or
the Window Length
setting in the Spectrum
Settings panel to determine the data window length. The
value of the FrequencyResolutionMethod
property determines
whether RBW or window length is used. Then, it partitions the input
signal into a number of windowed data segments. Finally, Spectrum
Analyzer uses the modified periodogram method to compute spectral
updates, averaging the windowed periodograms for each segment.
Spectrum Analyzer requires that a minimum number of samples have been provided before it computes 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 resolution bandwidth, RBW, by the following equation or to the window length, by the equation shown in step 1b.
$${N}_{samples}=\frac{\left(1\frac{{O}_{p}}{100}\right)\times NENBW\times {F}_{s}}{RBW}$$
The normalized effective noise bandwidth, NENBW, is a factor that depends on the windowing method. Spectrum Analyzer shows NENBW in the Window Options pane of the Spectrum Settings panel. Overlap percentage, O_{p}, is the value of the Overlap % parameter in the Window Options pane of the Spectrum Settings panel. F_{s} is the sample rate of the input signal. Spectrum Analyzer shows sample rate in the Main Options pane of the Spectrum Settings panel.
When in RBW mode, the window length required to compute one spectral update, N_{window}, is directly related to the resolution bandwidth and normalized effective noise bandwidth by the following equation.
When in WindowLength mode, the window length is used as specified.
The number of input samples required to compute one spectral update, N_{samples}, is directly related to the window length and the amount of overlap by the following equation.
When you increase the overlap percentage, fewer new input samples are needed to compute a new spectral update. For example, if the window length is 100, then the number of input samples required to compute one spectral update is given as shown in the following table.
O_{p}  N_{samples} 

0%  100 
50%  50 
80%  20 
The normalized effective noise bandwidth, NENBW, is a window parameter determined by the window length, N_{window}, and the type of window used. If w(n) denotes the vector of N_{window} window coefficients, then NENBW is given by the following equation.
When in RBW mode, you can set the resolution bandwidth using the value of the RBW parameter on the Main options pane of the Spectrum Settings panel. You must specify a value to ensure 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, as given in the following equation.
$$\frac{span}{RBW}>2$$
By default, the RBW parameter on the Main
options pane is set to Auto
.
In this case, the Spectrum Analyzer determines the appropriate value
to ensure that there are 1024 RBW intervals over the specified frequency
span. Thus, when you set RBW to Auto
,
it is calculated by the following equation.$$RB{W}_{auto}=\frac{span}{1024}$$
When in window length mode, you specify N_{window} and the resulting RBW is
In some cases, the number of samples provided in the input are not sufficient to achieve the resolution bandwidth that you specify. When this situation occurs, Spectrum Analyzer produces a message on the display, as shown in the following figure.
Spectrum Analyzer removes this message and displays a spectral estimate as soon as enough data has been input. Notice that this behavior differs from the Spectrum Scope block in versions R2012b and earlier. If the Buffer input check box was selected, the Spectrum Scope block computed a spectral update using the number of samples given by the Buffer size parameter. Otherwise, the Spectrum Scope block computed a spectral update using the number of samples in each frame.
Spectrum Analyzer calculates and plots the power spectrum,
power spectrum density, and RMS computed by the modified Periodogram estimator.
For more information about the Periodogram method, see periodogram
in
the Signal Processing Toolbox documentation.
Power Spectral Density — The power spectral density (PSD) is given by the following equation.
In this equation, x[n] is the discrete input signal. On every input signal frame, Spectrum Analyzer generates as many overlapping windows as possible, each window denoted as x^{(p)}[n], and computes their periodograms. Spectrum Analyzer displays a running average of the P most current periodograms.
Power Spectrum — The power spectrum is the product of the power spectral density and the resolution bandwidth, as given by the following equation.
Spectrogram — You can plot any power as a spectrogram. Each line of the spectrogram is one periodogram. The time resolution of each line is 1/RBW, which is the minimum attainable resolution. Achieving the resolution you want may require combining several periodograms may be combined. You then use interpolation to calculate noninteger values of 1/RBW. In the spectrogram display, time scrolls from bottom to top, so the most recent data is shown at the bottom of the display. The offset shows the time value at which the center of the most current spectrogram line occurred.
Note: The number of FFT points (N_{fft}) is independent of the window length (N_{window}). You can set them to different values provided that N_{fft} is greater than or equal to N_{window}. 
The Occupied BW is calculated as follows.
Calculate the total power in the measured frequency range.
Determine the lower frequency value. Starting at the lowest frequency in the range and moving upward, the power distributed in each frequency is summed until this sum is of the total power.
Determine the upper frequency value. Starting at the highest frequency in the range and moving downward, the power distributed in each frequency is summed until it reaches of the total power.
The bandwidth between the lower and upper power frequency values is the occupied bandwidth.
The frequency halfway between the lower and upper frequency values is the center frequency.
The Distortion Measurements are computed as follows.
Spectral content is estimated by finding peaks in the spectrum. When the algorithm detects a peak, it ignores all adjacent content that decreases monotonically from the peak. After recording the width of the peak, it clears all monotonically decreasing values (that is, it treats all of these values as if they belong to the peak). Using this method, all spectral content centered at DC (0 Hz) is removed from the spectrum and the amount of bandwidth cleared (W_{0}) is recorded.
The fundamental power (P_{1}) is determined from the remaining maximum value of the displayed spectrum. A local estimate (Fe_{1}) of the fundamental frequency is made by computing the central moment of the power in the vicinity of the peak. The bandwidth of the fundamental power content (W_{1}) is recorded. Then, the power associated from the fundamental is removed as in step 1.
The power and width of the second, and higher order harmonics (P_{2}, W_{2}, P_{3}, W_{3}, etc.) are determined in succession by examining the frequencies closest to the appropriate multiple of the local estimate (Fe_{1}). Any spectral content that decreases in a monotonically about the harmonic frequency is removed from the spectrum first before proceeding to the next harmonic.
Once the DC, fundamental, and harmonic content is removed from the spectrum, the power of the remaining spectrum is examined for its sum (P_{remaining}) peak value (P_{maxspur}), and its median value (P_{estnoise}).
The sum of all the removed bandwidth is computed as W_{sum} = W_{0}+W_{1}+W_{2}+...+W_{n}.
The sum of powers of the second and higher order harmonics are computed as P_{harmonic} = P_{2}+P_{3}+P_{4}+...+P_{n}.
The sum of the noise power is then estimated as P_{noise} = (P_{remaining}*dF + P_{estnoise}*W_{sum})/RBW, where dF is the absolute difference between frequency bins, and RBW is the resolution bandwidth of the window.
The metrics for SNR, THD, SINAD, and SFDR are then computed from the estimates.
$$\begin{array}{l}THD=10\cdot {\mathrm{log}}_{10}\left(\frac{{P}_{harmonic}}{{P}_{1}}\right)\\ SINAD=10\cdot {\mathrm{log}}_{10}\left(\frac{{P}_{1}}{{P}_{harmonic}+{P}_{noise}}\right)\\ SNR=10\cdot {\mathrm{log}}_{10}\left(\frac{{P}_{1}}{{P}_{noise}}\right)\\ SFDR=10\cdot {\mathrm{log}}_{10}\left(\frac{{P}_{1}}{\mathrm{max}\left({P}_{maxspur},\mathrm{max}\left({P}_{2},{P}_{3},\mathrm{...},{P}_{n}\right)\right)}\right)\end{array}$$
The following considerations apply to Distortion Measurements.
The harmonic distortion measurements use the spectrum
trace shown in the display as the input to the measurements. The default Hann
window
setting of the Spectrum Analyzer may exhibit leakage that can completely
mask the noise floor of the measured signal.
The harmonic measurements attempt to correct for leakage by ignoring all frequency content that decreases monotonically away from the maximum of harmonic peaks. If the window leakage covers more than 70% of the frequency bandwidth in your spectrum, you may see a blank reading (–) reported for SNR and SINAD. Consider using a Kaiser window with a high attenuation (up to 330dB) to minimize spectral leakage if your application can tolerate the increased equivalent noise bandwidth (ENBW) of the Kaiser window.
The DC component is ignored.
After windowing, the width of each harmonic component masks the noise power in the neighborhood of the fundamental frequency and harmonics. To estimate the noise power in each region, Spectrum Analyzer computes the median noise level in the nonharmonic areas of the spectrum. It then extrapolates that value into each region.
Nth order intermodulation products occur at
A*F1 + B*F2
where F1 and F2 are the sinusoid input frequencies and A + B = N. A and B are integer values.
For intermodulation measurements, the thirdorder intercept (TOI) point is computed as follows, where P is power in decibels of the measured power referenced to one milliwatt (dBm).:
TOI_{lower} = P_{F1} + (P_{F2}  P_{(2F1F2)})/2
TOI_{upper} = P_{F2} + (P_{F1}  P_{(2F2F1)})/2
TOI = + (TOI_{lower} + TOI_{upper})/2
dsp.ArrayPlot
 dsp.LogicAnalyzer
 dsp.TimeScope
 Spectrum
Analyzer