MATLAB Examples

Spectral Mask

This example shows how to create a new model based on the dsp_basic_filter template, add a spectral mask to its Spectrum Analyzer block, and run the model.

Masks are overlaid on the spectrum. If the mask is green, the signal is passing. If the mask is red, the signal is failing. The Spectral Mask panel shows what percentage of the time the mask is succeeding, which mask is failing, how many times the mask(s) failed, and which channels are causing the failure.

  [~,mdl] = fileparts(tempname);
  open_system(new_system(mdl,'FromTemplate','dsp_basic_filter'));
  saBlock = find_system(mdl,'BlockType','SpectrumAnalyzer');

  scopeConfig = get_param(saBlock{1},'ScopeConfiguration');
  upperMask = [0 50; 1200 50; 1200 -10; 24000 -10];
  scopeConfig.SpectralMask.UpperMask = upperMask;
  scopeConfig.SpectralMask.LowerMask = -100;
  scopeConfig.SpectralMask.EnabledMasks = 'Upper and lower';

  sim(mdl,'StopTime','20');