主要内容

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:

  1. In the Spectral Mask pane, select a Masks option.

  2. In the Upper limits or Lower limits box, enter the mask limits as a constant scalar, an array, or a workspace variable name.

  3. (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:

  1. Create a SpectralMaskSpecfication object.

  2. Set properties, such as EnabledMasks, LowerMask, or UpperMask.

  3. In the dsp.SpectrumAnalyzer or SpectrumAnalyzerConfiguration object, set the SpectralMask property equal to your SpectralMaskSpecfication object.

For example:

mask = SpectralMaskSpecification();
mask.EnabledMasks = 'Upper';
mask.UpperMask = 10;
scope = dsp.SpectrumAnalyzer();
scope.SpectralMask = mask;
scope.SpectralMask
ans = 

  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 MaskTestFailed event. To trigger a function when the mask fails, create a listener to the MaskTestFailed event and define a callback function to trigger. For more details about using events, see Events.