HE/heSigRecSetupPlots.m
2024-03-30 16:35:40 +08:00

66 lines
2.0 KiB
Matlab

function [SpectrumAnalyzer,TimeScope,ConstellationDiagram,EVMPerSubcarrier,EVMPerSymbol] = heSigRecSetupPlots(sr)
%heSigRecSetupPlots Create measurement plots for the featured example
% Copyright 2018-2019 The MathWorks, Inc.
% Scale and position plots on the screen
[repositionPlots,position] = helperPlotPositions();
% Create spectrum analyzer to plot spectrum of packet
SpectrumAnalyzer = dsp.SpectrumAnalyzer;
SpectrumAnalyzer.Name = 'Detected packet signal spectrum';
SpectrumAnalyzer.SampleRate = sr;
SpectrumAnalyzer.ShowLegend = true;
SpectrumAnalyzer.RBWSource = 'Property';
SpectrumAnalyzer.RBW = 100e3;
SpectrumAnalyzer.SpectralAverages = 3;
if repositionPlots
SpectrumAnalyzer.Position = position(1,:);
end
% Create time scope to plot detected packet
TimeScope = timescope;
TimeScope.Name = 'Detected packet';
TimeScope.YLabel = 'Magnitude';
TimeScope.PlotType = 'Line';
TimeScope.ShowGrid = true;
TimeScope.ShowLegend = true;
TimeScope.SampleRate = sr;
TimeScope.TimeSpanSource = 'property';
if repositionPlots
TimeScope.Position = position(2,:);
end
% Create a constellation diagram to plot equalized symbols
ConstellationDiagram = comm.ConstellationDiagram;
ConstellationDiagram.ShowReferenceConstellation = true;
ConstellationDiagram.ShowGrid = true;
ConstellationDiagram.Name = 'Equalized data symbols';
if repositionPlots
ConstellationDiagram.Position = position(5,:);
end
ConstellationDiagram.ShowLegend = 1;
% Display EVM plot per subcarrier
EVMPerSubcarrier = dsp.ArrayPlot;
EVMPerSubcarrier.PlotType = 'Line';
EVMPerSubcarrier.ShowLegend = true;
EVMPerSubcarrier.XLabel = 'Subcarrier index';
EVMPerSubcarrier.YLabel = 'EVM (dB)';
EVMPerSubcarrier.Name = 'EVM per subcarrier';
if repositionPlots
EVMPerSubcarrier.Position = position(3,:);
end
% Display EVM plot per symbol
EVMPerSymbol = dsp.ArrayPlot;
EVMPerSymbol.PlotType = 'Line';
EVMPerSymbol.ShowLegend = true;
EVMPerSymbol.XLabel = 'Symbol index';
EVMPerSymbol.YLabel = 'EVM (dB)';
EVMPerSymbol.Name = 'EVM per symbol';
if repositionPlots
EVMPerSymbol.Position = position(4,:);
end
end