Main Content

5G Dynamic EVM Measurement of Linearized PA System

This example shows you how to:

  • Define a 5G Toolbox™ testbench to generate a 5G standard compliant waveform and measure the EVM and then integrate the RF Blockset™ circuit envelope model of the PA in this testbench using the rfsystem workflow.

  • Run the 5G error vector magnitude (EVM) testbench with and without DPD algorithm in the loop and visualize results.

5G Waveform Simulation Parameters

Setup 5G NR PDSCH Waveforms for EVM Measurement. Measure the PA 3GPP dynamic EVM with and without DPD. The EVM is measured as defined in TS 38.104, Annex B(FR1) / Annex C(FR2).

The GenerateNRTMWaveform script generates a standard-compliant 5G NR test model 3.1 (NR-TM3.1) waveform for frequency range 1 (FR1), as defined in TS 38.141-1. To generate a different NR test model, open the 5G Waveform Generator (5G Toolbox) app, choose your preferred configuration and click on Export MATLAB script.

rc = "NR-FR1-TM3.1"; % Reference channel (NR-TM or FRC)
bw = "100MHz"; % Channel bandwidth
scs = "30kHz"; % Subcarrier spacing
dm = "FDD"; % Duplexing mode

tmwavegen= hNRReferenceWaveformGenerator(rc,bw,scs,dm);
tmwavegen = makeConfigWritable(tmwavegen);
tmwavegen.Config.SampleRate = 122.88e6*4;
tmwavegen.Config.NumSubframes = 1;

[refWaveform,tmwaveinfo,resourcesinfo] = generateWaveform(tmwavegen,...

SampleRate = tmwaveinfo.Info.SamplingRate; % waveform sample rate
refWaveform = refWaveform./max(abs(refWaveform)); % normalize to 1 max magnitude

Modify the amplitude of the input signal to excite the PA nonlinearity. At this stage, make sure that the input signal is within the characterization range of the PA model.

inWaveform5G = refWaveform*0.6;
disp(['Maximum input voltage = ' num2str(max(abs(inWaveform5G)))])
Maximum input voltage = 0.6

Load RF Model with PA and DPD Algorithm

The Simulink® model rf_dpd_model is invoked directly from MATLAB® using the rfsystem object rf_dpd. This allows a simpler approach to directly integrate Simulink models within a MATLAB testbench. For more information, see rfsystem.

Set the SampleTime of the rf_dpd object to be consistent with the sample time of the generated 5G waveform.

load RF_system;
rf_dpd.SampleTime = 1/tmwavegen.Config.SampleRate;

Simulate PA Model with 5G Waveforms

First, simulate the PA model without DPD. Make sure that the manual switch is set in the up position. This simulation takes a few minutes as it is actually testing one entire frame (1 ms) of 5G data.

outWaveformRF = rf_dpd(inWaveform5G);

As a second step, simulate the PA including DPD by toggling the manual switch towards the down position.

outWaveformDPD = rf_dpd(inWaveform5G);

Release system resources and turn off fast restart for the RF system object and its associated Simulink model.


Compare the results by visualizing the output waveforms with and without DPD.

First, visualize results in the time domain.

plot((1:length(outWaveformRF))*Tstep, abs(outWaveformRF),               ...
     (1:length(outWaveformRF))*Tstep, abs(outWaveformDPD));
legend('Output without DPD','Output with DPD','Location','northeast')
xlabel('Time (s)')
xlim([1e-6 2e-6])
ylabel('Voltage (V)')
title('Absolute Values of Input and Output Voltage Signals');

Second, visualize the power gain transfer function.

TransferPA = abs(outWaveformRF./inWaveform5G);
TransferPA_dpd = abs(outWaveformDPD./inWaveform5G);
plot(abs(inWaveform5G), 20*log10(TransferPA), 'o',                     ...
     abs(inWaveform5G), 20*log10(TransferPA_dpd), '.')
ylim([0 40])
xlabel('Input Voltage Absolute Value(V)')
ylabel('Magnitude Power Gain (dB)')
title('Power Gain Transfer Function')
legend({'Output without DPD','Output with DPD'})

Finally, plot the spectrum of the output signals.

SpectAnalyzer = spectrumAnalyzer;
SpectAnalyzer.SampleRate = 1/Tstep;
SpectAnalyzer.RBWSource ="Property";
SpectAnalyzer.RBW = 1e5;
SpectAnalyzer.SpectralAverages = 32;
SpectAnalyzer.ReferenceLoad = 50;
SpectAnalyzer([outWaveformRF outWaveformDPD]);
SpectAnalyzer.ChannelNames = {'Output without DPD', 'Output with DPD'};
SpectAnalyzer.ShowLegend = true;

Perform 3GPP Dynamic EVM Measurements

The helper function hNRDownlinkEVM, performs these steps to decode and analyze the waveform:

  • Synchronization using the DM-RS over one frame for FDD (two frames for TDD)

  • OFDM demodulation of the received waveform

  • Channel estimation

  • Equalization

  • PDSCH EVM computation (enable the switch evm3GPP to process as per the EVM measurement requirements specified in TS 38.104, Annex B(FR1) / Annex C(FR2))

You then complete the following steps.

  • Measure and output various EVM-related statistics (that is per symbol, per slot, and per frame peak EVM and RMS EVM).

  • Display EVM for each slot and frame in the command window.

  • Display the overall EVM averaged over the entire input waveform.

  • Generate the EVM plots versus per OFDM symbol, slot, subcarrier, and overall EVM. Each plot displays the peak versus the RMS EVM.

First, set up the global parameters for EVM measurements.

cfg = struct();
cfg.Evm3GPP = false;
cfg.TargetRNTIs = [];
cfg.PlotEVM = true;
cfg.DisplayEVM = true;
cfg.Label = tmwavegen.ConfiguredModel{1};
cfg.UseWholeGrid = true;
cfg.TimeSyncEnable = true;
cfg.CorrectCoarseFO = true;
cfg.CorrectFineFO = true;
cfg.PdcchEnable = false;

Compute and display EVM measurements for the waveform without DPD.

[evmInfo,eqSym,refSym] = hNRDownlinkEVM(tmwavegen.Config,outWaveformRF,cfg);
disp(['EVM RMS = ' num2str(evmInfo.PDSCH.OverallEVM.RMS*100) '%']);
EVM stats for BWP idx : 1
PDSCH RMS EVM, Peak EVM, slot 0: 2.848 9.653%
PDSCH RMS EVM, Peak EVM, slot 1: 2.983 10.793%
Averaged overall PDSCH RMS EVM: 2.916%
Overall PDSCH Peak EVM = 10.7934%
EVM RMS = 2.9163%

Compute and display EVM measurements for the waveform including DPD.

[evmInfo,eqSym,refSym] = hNRDownlinkEVM(tmwavegen.Config,outWaveformDPD,cfg);
disp(['EVM RMS = ' num2str(evmInfo.PDSCH.OverallEVM.RMS*100) '%']);
EVM stats for BWP idx : 1
PDSCH RMS EVM, Peak EVM, slot 0: 0.851 2.944%
PDSCH RMS EVM, Peak EVM, slot 1: 1.397 5.463%
Averaged overall PDSCH RMS EVM: 1.156%
Overall PDSCH Peak EVM = 5.4625%
EVM RMS = 1.1565%

Further Exploration

You can further enhance the Simulink model by including the transceiver that includes a modulator for upconversion to RF, and an observer receiver to sense the PA output. For more information, see Digital Predistortion to Compensate for Power Amplifier Nonlinearities

To further accelerate PA-DPD simulation, see Speed Up PA and DPD simulation

See Also