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:
spectrumAnalyzer
objectSpectrumAnalyzerBlockConfiguration
object 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.3760 You 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)