Spectral Masks
Add upper and lower masks to the Spectrum Analyzer to visualize spectrum limits and compare spectrum values to specification values.
To open the Spectral Mask pane, in the toolbar, select the spectral
mask button
.
Set Up Spectral Masks
In the Spectrum Analyzer window:
In the Spectral Mask pane, select a Masks option.
In the Upper limits or Lower limits box, enter the mask limits as a constant scalar, an array, or a workspace variable name.
(Optional) Select additional properties:
Reference level — Set a reference level for the mask. Enter a specific value or select
Spectrum peak.Channel — Select a channel to use for the mask reference.
Frequency offset — Set a frequency offset for mask.
From the command-line, to add a spectral mask to the dsp.SpectrumAnalyzer (DSP System Toolbox) System object or the SpectrumAnalyzerConfiguration (DSP System Toolbox) block configuration object:
Create a
SpectralMaskSpecficationobject.Set properties, such as
EnabledMasks,LowerMask, orUpperMask.In the
dsp.SpectrumAnalyzerorSpectrumAnalyzerConfigurationobject, set theSpectralMaskproperty equal to yourSpectralMaskSpecficationobject.
For example:
mask = SpectralMaskSpecification();
mask.EnabledMasks = 'Upper';
mask.UpperMask = 10;
scope = dsp.SpectrumAnalyzer();
scope.SpectralMask = mask;
scope.SpectralMaskans =
SpectralMaskSpecification with properties:
EnabledMasks: 'Upper'
UpperMask: 10
LowerMask: -Inf
ReferenceLevel: 'Custom'
CustomReferenceLevel: 0
MaskFrequencyOffset: 0
Events for class SpectralMaskSpecification: MaskTestFailed
Check Spectral Masks
You can check the status of the spectral mask in several different ways:
In the Spectrum Analyzer window, select the spectral mask button
. In the Spectral Mask pane, the
Statistics section shows statistics about how often the masks
fail, which channels have caused a failure, and which masks are currently
failing.To get the current status of the spectral masks, call
getSpectralMaskStatus(DSP System Toolbox).To perform an action every time the mask fails, use the
MaskTestFailedevent. To trigger a function when the mask fails, create a listener to theMaskTestFailedevent and define a callback function to trigger. For more details about using events, see Events.