Main Content

nrEVM

Measure error vector magnitude (EVM)

Since R2025a

Description

[rmsEVM,peakEVM,infoEVM] = nrEVM(carrier,channel,rxGrid) measures the EVM for the specified carrier configuration, carrier, channel configuration, channel, and received grid, rxGrid. The function performs channel estimation using the reference signals, zero-forcing (ZF) equalization, reference data symbol reconstruction using hard slicing, and then measures the EVM using equalized and reconstructed symbols. rmsEVM is the root mean square (RMS) EVM. peakEVM is the peak EVM. infoEVM is a structure containing information about the EVM processing. Use this syntax for single-slot EVM processing.

example

[rmsEVM,peakEVM,infoEVM] = nrEVM(carrier,channel,rxGrid,TxDirectCurrentLocation=location) specifies the direct current (DC) subcarrier location for the carrier, carrier. Use this syntax to exclude the information at the specified location from the EVM measurements.

[rmsEVM,peakEVM,infoEVM] = nrEVM(eqGrid,refGrid) measures the EVM for the specified equalized grid, eqGrid, and reference grid, refGrid. Use this syntax when equalized and reference symbols are readily available.

example

Examples

collapse all

Create a transmit resource grid that contains PDSCH and PDSCH DM-RS symbols.

carrier = nrCarrierConfig;
pdsch = nrPDSCHConfig;
pdsch.Modulation = "256QAM";
[pdschIndices,pdschInfo] = nrPDSCHIndices(carrier,pdsch);
cw = randi([0 1],pdschInfo.G,1);
pdschSym = nrPDSCH(carrier,pdsch,cw);
pdschDMRSInd = nrPDSCHDMRSIndices(carrier,pdsch);
pdschDMRSSym = nrPDSCHDMRS(carrier,pdsch);
txGrid = nrResourceGrid(carrier);
txGrid(pdschIndices) = pdschSym;
txGrid(pdschDMRSInd) = pdschDMRSSym;

Perform OFDM modulation of the transmit grid.

[txWaveform,ofdmInfo] = nrOFDMModulate(carrier,txGrid);
evmPercent = 2.0;

Add noise to the transmit waveform.

noise = evmPercent/(100*sqrt(ofdmInfo.Nfft))* randn(size(txWaveform),like=1i);
rxWaveform = txWaveform + noise;

Perform OFDM demodulation of the received waveform.

rxGrid = nrOFDMDemodulate(carrier,rxWaveform);

Measure the EVM of the PDSCH.

[rmsEVM,peakEVM,evmInfo] = nrEVM(carrier,pdsch,rxGrid);
disp("EVM RMS of PDSCH data = " + (rmsEVM*100) + " %")
EVM RMS of PDSCH data = 2.2187 %

Measure the EVM of the PDSCH DM-RS using the additional information.

ev = evmInfo.ErrorVectorGrid;
dmrsEV = ev(pdschDMRSInd);
rmsDMRSEVM = sqrt(mean(abs(dmrsEV).^2));
disp("EVM RMS of PDSCH DM-RS = " + (rmsDMRSEVM*100) + " %")
EVM RMS of PDSCH DM-RS = 1.6288 %

Plot the equalized and ideal constellation of the PDSCH and PDSCH DM-RS.

f = figure(1);
ax = axes(f);
plot(ax,evmInfo.EqualizedGrid(pdschIndices),"b.")
hold on
plot(ax,pdschSym,"r+")
plot(ax,evmInfo.EqualizedGrid(pdschDMRSInd),"y.")
plot(ax,pdschDMRSSym,"k+")
axis(ax,'equal')
hold off
legend(ax,"Data eq.","Data ref.","DM-RS eq.","DM-RS ref.")
title(ax,"Constellation Diagram")
ylabel(ax,"Quadrature Amplitude")
xlabel(ax,"In-Phase Amplitude")

Figure contains an axes object. The axes object with title Constellation Diagram, xlabel In-Phase Amplitude, ylabel Quadrature Amplitude contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent Data eq., Data ref., DM-RS eq., DM-RS ref..

Plot the EVM resource grid.

f2 = figure(2);
ax = axes(f2);
surf(ax,abs(ev)*100)
shading flat
view(-30,60)
title(ax,"EVM Resource Grid")
xlabel(ax,"OFDM Symbols")
ylabel(ax,"Subcarriers")
zlabel(ax,"EVM (%)")

Figure contains an axes object. The axes object with title EVM Resource Grid, xlabel OFDM Symbols, ylabel Subcarriers contains an object of type surface.

Generate a grid of a random QPSK constellation with a defined EVM.

idealGrid = zeros([624 14],like=1i);
numREs = numel(idealGrid);
idealSym = nrSymbolModulate(randi([0 1],numREs*2,1),"QPSK");
idealGrid(1:numREs) = idealSym;

Add noise with a defined EVM.

evmPercent = 14;
N0 = randn(size(idealGrid),like=1i);
noise = N0*(evmPercent/100);
rxGrid = idealGrid+noise;

Measure and display the RMS and peak EVM level in percent.

[rmsEVM,peakEVM] = nrEVM(rxGrid,idealGrid);
disp("EVM RMS = " + (rmsEVM*100) + " %")
EVM RMS = 13.9251 %
disp("EVM Peak = " + (peakEVM*100) + " %")
EVM Peak = 39.9252 %

Input Arguments

collapse all

Carrier configuration parameters for a specific OFDM numerology, specified as an nrCarrierConfig object.

Channel configuration parameters, specified as one of these channel objects:

Received grid, specified as a complex-valued array of size K-by-N-by-R-by-E.

  • K is the number of subcarriers and must be equal to carrier.NSizeGrid×12, which is the number of subcarriers in the specified carrier.

  • N is the number of OFDM symbols and must be equal to the number of OFDM symbols in a slot: 14 for normal cyclic prefix and 12 for extended cyclic prefix.

  • R is the number of receive antennas.

  • E is 1 or 2, corresponding to the number of EVM window edges. When E is 1, the function performs channel estimation by using the nrChannelEstimate function. When E is 2, the function performs channel estimation, as defined in TS 38.104 for PDSCH and TS 38.101-1 and TS 38.101-2 for PUSCH.

Data Types: single | double
Complex Number Support: Yes

DC subcarrier location for the carrier, specified as one of these values:

  • []— The EVM measurement is for the entire carrier.

  • Nonnegative integer — The EVM measurement excludes the information at the specified DC subcarrier location for the carrier. This value is defined by the uplinkTxDirectCurrentBWP and SCS-SpecificCarrier radio resource control (RRC) information elements (IEs).

Data Types: double

Equalized grid, specified as a complex-valued array of size S-by-N-by-L-by-E.

  • S is the number of subcarriers.

  • N is the number of symbols spanning the duration of the waveform.

  • L is the number of layers.

  • E is 1 or 2, corresponding to the number of EVM window edges.

Note

The dimensions of the eqGrid and refGrid inputs must be the same.

Data Types: single | double
Complex Number Support: Yes

Reference grid, specified as a complex-valued array of size S-by-N-by-L-by-E.

  • S is the number of subcarriers.

  • N is the number of symbols spanning the duration of the waveform.

  • L is the number of layers.

  • E is 1 or 2, corresponding to the number of EVM window edges.

Note

The dimensions of the eqGrid and refGrid inputs must be the same.

Data Types: single | double
Complex Number Support: Yes

Output Arguments

collapse all

RMS EVM in linear scale, returned as a nonnegative real scalar. This value is the square root of the mean of the squares of all the values of the EVM.

For the carrier-based syntaxes, rmsEVM inherits the data type of rxGrid. For the reference grid-based syntax, rmsEVM is of single data type if either eqGrid or refGrid is of single data type.

Data Types: single | double

Peak EVM in linear scale, returned as a nonnegative real scalar. This value is the largest EVM value calculated across all resource elements.

For the carrier-based syntaxes, peakEVM inherits the data type of rxGrid. For the reference grid-based syntax, peakEVM is of single data type if either eqGrid or refGrid is of single data type.

Data Types: single | double

EVM processing information, returned as structure containing these fields:

FieldValueDescription
ErrorVectorGridComplex-valued array of size K-by-N-by-P-by-E

Normalized error vectors, returned as a complex-valued array of size K-by-N-by-P-by-E.

  • K is the number of subcarriers.

  • N is the number of OFDM symbols.

  • P is number of reference ports.

  • E is the number of EVM window edges.

For the carrier-based syntaxes, the error vector is the ratio of the difference in equalized symbols and reconstructed symbols to the normalization factor. The normalization factor is computed using the reconstructed symbols for each slot and each layer independently.

For the reference grid-based syntax, the error vector is the ratio of difference in equalized grid and reference grid to the normalization factor. The normalization factor is computed using all the nonzero values in the reference grid.

EqualizedGridComplex-valued array of size K-by-N-by-P-by-E

Equalized symbols of all the entities in the channel, returned as a complex-valued array of size K-by-N-by-P-by-E.

  • K is the number of subcarriers.

  • N is the number of OFDM symbols.

  • P is number of reference ports.

  • E is the number of EVM window edges.

For PDCCH, the equalized grid contains control information symbols and DM-RS symbols.

For PDSCH or PUSCH, the equalized grid contains the data symbols, DM-RS symbols, and PT-RS symbols if present.

For PUSCH with transform precoding enabled, the data symbols and PT-RS symbols, if present, are the symbols after transform de-precoding.

Data Types: struct

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2025a