Main Content


Get test results of current spectral mask



results = getSpectralMaskStatus(scope) returns the current status of the spectral mask on the spectrum analyzer, scope, in a structure, results.


collapse all

This example shows how to add a spectral mask to an existing dsp.SpectrumAnalyzer System object scope and get the status with getSpectralMaskStatus.

sine = dsp.SineWave('Frequency',[98 100],'SampleRate',1000);
sine.SamplesPerFrame = 1024;
scope = dsp.SpectrumAnalyzer('SampleRate',sine.SampleRate, ...

scope.SpectralMask.EnabledMasks = 'Upper and lower';
upperMask = [0 -10; 90 -10; 90 30; 110 30; 110 -10; 500 -10];

for i=1:100
    scope(sine() + 0.05*randn(1024,2));

res = getSpectralMaskStatus(scope)
res = 

  struct with fields:

    IsCurrentlyPassing: 0
        NumPassedTests: 1
         NumTotalTests: 33
           SuccessRate: 3.0303
          FailingMasks: 'Lower'
       FailingChannels: [1 2]
        SimulationTime: 101.3760

In the Spectrum Analyzer, you can see the same information in the Spectral Mask panel.


Input Arguments

collapse all

Spectrum Analyzer with spectral masks whose status you want to check. Specified by the name of the dsp.SpectrumAnalyzer object.

Output Arguments

collapse all

The results return the current status of the spectral mask with these properties:


Indicator of whether one or more masks are currently passing

1 — All masks are passing

0 — One or more masks are failing

NumPassedTestsNumber of mask tests that have passed
NumTotalTestsTotal number of mask tests
SuccessRatePercentage of tests that have passed
FailingChannelsArray of channel numbers that are currently failing the mask test
FailingMasksCharacter array of which masks are currently failing: 'None', 'Upper', 'Lower', or 'Upper and lower'
SimulationTimeSimulation time

Introduced in R2017a