getSpectralMaskStatus
Get test results of current spectral mask
Description
Examples
Add a spectral mask to an existing spectrumAnalyzer object. Use the getSpectralMaskStatus function to get the spectral mask status.
sine = dsp.SineWave(Frequency=[98 100],SampleRate=1000); sine.SamplesPerFrame = 1024; scope = spectrumAnalyzer(SampleRate=sine.SampleRate,... PlotAsTwoSidedSpectrum=false,ShowLegend=true,YLimits=[-60 40]); 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)
res = struct with fields:
IsCurrentlyPassing: 1
NumPassedTests: 44
NumTotalTests: 51
SuccessRate: 86.2745
FailingMasks: ''
FailingChannels: [1×0 double]
SimulationTime: 102.3990
You can also view the status in the Spectral Mask tab on the Spectrum Analyzer toolstrip.
show(scope); release(scope);

Input Arguments
Spectrum Analyzer with spectral masks, specified as one of the following:
spectrumAnalyzerobjectSpectrumAnalyzerBlockConfigurationobject for a Spectrum Analyzer block
Output Arguments
Current status of the spectral mask, returned as a structure with these fields.
| Field | Description |
|---|---|
IsCurrentlyPassing | Pass status of one or more masks.
|
NumPassedTests | Number of mask tests that have passed |
NumTotalTests | Total number of mask tests |
SuccessRate | Percentage of tests that have passed |
FailingChannels | Array of channel numbers that have currently failed the mask test |
FailingMasks | Masks that have currently failed:
"none",
"upper",
"lower", or
"upper-and-lower" |
SimulationTime | Simulation time |
Version History
Introduced in R2017aThe dsp.SpectrumAnalyzer
System object™ warns in R2024a. Use the spectrumAnalyzer object instead.
Update Code
No updates to your code are required except replacing instances of
dsp.SpectrumAnalyzer with
spectrumAnalyzer.
This table shows how the getSpectralMaskStatus function
typically uses the dsp.SpectrumAnalyzer
System object and explains how to update existing code to use the
spectrumAnalyzer object.
| Discouraged Usage | Recommended Replacement |
|---|---|
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,... 'YLimits',[-60 40]); 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) res =
struct with fields:
IsCurrentlyPassing: 0
NumPassedTests: 1
NumTotalTests: 33
SuccessRate: 3.0303
FailingMasks: 'Upper and lower'
FailingChannels: [1 2]
SimulationTime: 101.3760You can see the same information in the Spectral Mask panel of the Spectrum Analyzer. show(scope); release(scope); | Add a spectral mask to an existing
The To retain
the same default behavior as the
sine = dsp.SineWave(Frequency=[98 100],SampleRate=1000); sine.SamplesPerFrame = 1024; scope = spectrumAnalyzer(SampleRate=sine.SampleRate,... PlotAsTwoSidedSpectrum=false,ShowLegend=true,... Method="welch",AveragingMethod="exponential",... ForgettingFactor=0.4,YLimits=[-60 40]); 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) res = struct with fields:
IsCurrentlyPassing: 1
NumPassedTests: 32
NumTotalTests: 33
SuccessRate: 96.9697
FailingMasks: ''
FailingChannels: [1×0 double]
SimulationTime: 102.3990
You can see the same information in the Spectral Mask tab on the Spectrum Analyzer toolstrip. show(scope); release(scope); |
The getSpectralMaskStatus function will stop supporting the
dsp.SpectrumAnalyzer object in a future release. Use the
spectrumAnalyzer object instead.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)