%% Get Spectral Mask Status
% 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, ...
       'PlotAsTwoSidedSpectrum',false,'ShowLegend',true);
hide(scope);

scope.SpectralMask.EnabledMasks = 'Upper and lower';
upperMask = [0 -10; 90 -10; 90 30; 110 30; 110 -10; 500 -10];
set(scope.SpectralMask,'UpperMask',upperMask,'LowerMask',-55);

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

res = getSpectralMaskStatus(scope)
%% 
% In the Spectrum Analyzer, you can see the same information in the Spectral 
% Mask panel.
%%
show(scope);
release(scope);

%% 
% Copyright 2012 The MathWorks, Inc.