White Paper

Introduction

Developing 5G New Radio (NR) wireless systems requires extensive simulation and testing. Being able to simulate the behavior of a system before building it provides significant cost benefits and greatly reduces the overall time it takes to release a new system into production. Despite all the benefits of simulation, eventually the system will need to be tested in real-world conditions using prototype transmitters and receivers. Over-the-air testing (OTA) plays an important role in this phase of system development. Whether you are simulating or testing your system over the air, MATLAB® and Simulink® can help you move your wireless system from early design through to production.

section

Challenges

When developing 5G wireless systems, the complexity of system components poses a design and testing challenge. Engineers need to tackle the following problems:

  • Compliance with standards — You need to design the transmitter and channel models in complete compliance with standards specifications. This means developing algorithms that represent the mathematical models described in 5G specifications documents.
  • Algorithmic testing with required parameter coverage — You then must generate a slew of 5G-compliant test signals to ensure that all possible modes of operation are covered. You also need to add various RF impairments and use a multitude of receiver models to recover the signal. All this adds to the complexity of testing the end-to-end link-level performance of the system. Here, metrics such as bit error rate (BER), block error rate (BLER), error vector magnitude (EVM), and throughput are used to verify that the system performance meets design specifications.
  • Device-under-test verification — After all algorithms are implemented in hardware, you need to test the performance of the system with hardware-under-test using OTA transmission and/or reception.
  • Integration testing and parameter optimization — Finally, you need to make sure the performance as expected by the standard can be achieved under various distortion conditions. Perform measurements to qualify at any given time how much distortion it can tolerate.

Figure 1 shows some of the key components. We start with user data such as voice, video, or text that come to the physical layer from higher layers of the communications stack. These bits of information then flow into the transmitter subsystem, which defines the channel coding and modulation needed to generate the baseband IQ signal. For example, in a 5G-compliant signal, channel coding might include low-density-parity check (LDPC) or polar coding, which is an encoding scheme that helps correct errors in the presence of noise and interference. Once the channel is coded, data will get modulated using modulation schemes like QPSK, 16QAM, 64QAM, or 256QAM. MIMO techniques such as beamforming are then used. Using OFDM modulation, the baseline signal is generated and mapped as output on multiple antenna layers and elements. The resulting signal is then transmitted over the air.

Diagram of components of a 5G wireless communication system.

Figure 1. Components of a 5G wireless communication system.

After the transmitted signal is distorted by the channel, it is acquired and processed by the receiver. Here, we perform the “inverse operations” of those performed at the transmitter to recover the best estimate of the transmitted bits of information. These operations include synchronization and OFDM demodulation, channel estimation and equalization, demodulation, descrambling, and channel decoding.

section

Workflow

In this section, we’ll cover how to address many of the challenges in 5G system design and testing by leveraging MATLAB, 5G Toolbox™, Instrument Control Toolbox™, and the Wireless Waveform Generator app. We will go over the entire test and verification workflow:

  • Generate baseband waveforms using 5G Waveform Generator app.
  • Transmit signals over the air.
  • Read IQ data from a signal analyzer over TCP/IP.
  • Perform measurements of received 5G waveform.

Specifically, we will generate a 5G NR test model (NR-TM) waveform using the 5G Waveform Generator app and download the generated waveform to a Keysight® E4438C vector signal generator for over-the-air transmission using Instrument Control Toolbox. We will then capture the transmitted over-the-air signal using a Keysight N9030A signal analyzer and analyze the signal in MATLAB. This diagram shows the general workflow.

A diagram showing OTA waveform generation, capture, and analysis using RF test equipment.

Figure 2. OTA waveform generation, capture, and analysis using RF test equipment.

section

Generate Baseband Waveform Using 5G Waveform Generator App

The first thing you need for testing is 5G waveforms. 5G Toolbox comes with functions, apps, and reference examples, enabling you to characterize and generate 5G NR uplink and downlink waveforms. Waveform generation is done either programmatically (by writing MATLAB programs using 5G Toolbox functions) or interactively (by using an app).

The Wireless Waveform Generator app is essentially a user interface that makes the task of waveform generation easier and more interactive. With the app, you can create a variety of signals, including 5G NR, LTE, 802.11 (Wi-Fi®), and Bluetooth® without writing any code. In order to assess the effects of RF designs on system performance, you can add impairments such as phase offset, frequency offset, and IQ imbalance to the signal. Once you have created your signal, you can visualize the signal on the built-in spectrum analyzer. The 5G NR standard defines sets of predefined link and waveform configurations for the purposes of conformance testing. These include NR test models (NR-TM) for the purpose of base station (eNodeB) RF testing and downlink fixed reference channels (FRC) for user equipment (UE) input testing.

The Wireless Waveform Generator app enables you to generate waveforms based on two options: predefined NR-TM or FRC sets, or custom designed 5G NR waveforms. Let us start by generating predefined NR test models.

In MATLAB, on the Apps tab, click the 5G Waveform Generator app to launch the app. In the Waveform Type section, click NR Test Models to set the parameters for the selected waveform. For this example, we choose the following parameters:

  • Set Frequency range as FR1 (410 MHz–7.125 GHz)
  • Set Test model as NR-FR1-TM3.1 (Full band, uniform 64 QAM)
  • Set Channel bandwidth (MHz) as 10
  • Set Subcarrier spacing (kHz) as 30
  • Set Duplex mode as FDD

On the app toolstrip, click Generate. The app now displays the spectrum of the 5G NR test signal.

By going through a slew of parameters and different types of 5G NR waveforms, such as the one highlighted above, you can make sure that various test conditions of your design are covered.

A screenshot of Wireless Waveform Generate app customizing and generating 5G NR-TM waveforms.

Figure 3. Wireless Waveform Generate app customizing and generating 5G NR-TM waveforms.

Frequency range in 5G is either FR1, less than 7 gigahertz, or FR2, a millimeter wave. Next, you choose a bandwidth depending on the frequency range and set your general parameters. Then, you can select the different components of a signal. When you click Generate, the app automatically provides two visualizations of the signal. The first visualization is a standard frequency domain (spectrum analyzer) view of the signal. The second visualization shows a time and frequency resource grid. With the Export tab, you can export the waveform to either a workspace file or MATLAB script. All the selections you chose to define the waveform are reflected in line-by-line parameterization in MATLAB. This generated MATLAB code can be used outside of the app for programs that generate a variety of 5G waveforms for large-scale testing of your designs.

As of release 2021a of MATLAB, you can also use the Wireless Waveform Generator app to generate custom downlink and uplink waveforms by setting parameter channels and signals individually.

To specify parameters of the waveform, you use the different tabs provided in the app. For example, if you want to generate custom 5G downlink waveforms, you can configure your selected parameter set in the SS Burst (Synchronization Signal Burst) and PDSCH (Physical Downlink Share Channel) tabs, and control data contained in the PDCCH (Physical Downlink Control Channel) and CSI-RS (Channel State Information Reference Signals) tabs. You can allocate multiple users to different bandwidth parts (BP) and assign different parameters to each user. Figure 4 shows the visualization results of a 5G NR downlink custom waveform using default parameters.

A screenshot of the Wireless Waveform Generate app customizing and generating custom 5G downlink waveforms.

Figure 4. Wireless Waveform Generate app customizing and generating custom 5G downlink waveforms.

For the remainder of this article, we are using the NR-TM generated waveform.

section

Transmit Over-the-Air Signal

To send out the signal over the air, you can use the Transmitter tab on the Wireless Waveform Generator app. Here, you can connect to signal generators from Keysight, Rhode & Schwarz, and other vendors. The app supports signal generators that connect over TCP/IP and have an IVI or SCPI driver. You can configure the carrier frequency and output power in the app. The app automatically finds the signal generator that is connected over the TCP/IP interface.

It is very easy to do this. On the Transmitter tab of the Wireless Waveform Generator app:

  • Set Driver to Agilent/Keysight Signal Generator SCPI
  • Set Center Frequency (GHz) to 3.4
  • Set Output Power (dbM) to -15

The app automatically obtains the baseband sample rate from the generated waveform. To start the transmission, all we need to do is click Transmit in the toolstrip. At this point we’ve generated and transmitted the 5G NR waveform without writing any code.

A screenshot showing waveform transmission in the Wireless Waveform Generator app.

Figure 5. Connect to RF Signal Generators and transmit the waveform using the Wireless Waveform Generator app.

section

Read IQ Data from a Signal Analyzer

Now that we’ve transmitted the signal over the air, we need to receive the IQ data from a signal analyzer. In our case, the signal analyzer has an antenna attached to receive the signal. We will perform the signal acquisition using MATLAB code. The code sections below are representative and illustrate the key steps to acquire and analyze IQ data in MATLAB. To get access to the complete code, see this example.

To read the in-phase and quadrature (IQ) data into MATLAB for analysis, we first configure the Keysight N9030A signal analyzer using Instrument Control Toolbox. We will need to define the instrument configuration parameters based on the signal being measured.

% Set parameters for the spectrum analyzer
centerFrequency = 3.4e9; 
sampleRate = 15.36e6;
measurementTime = 20e-3;
mechanicalAttenuation = 0; %dB
startFrequency = 3.39e9; 
stopFrequency = 3.41e9;
resolutionBandwidth = 220e3; 
videoBandwidth = 220000;

We also need to perform these steps before connecting to the spectrum analyzer. This can be accomplished with a few lines of MATLAB code.

  • Find the resource ID of the Keysight N9030A signal analyzer.
  • Connect to the instrument using the virtual instrument software architecture (VISA) interface.
  • Adjust the input buffer size to hold the data that the instrument returns.
  • Set the timeout to allow sufficient time for the measurement and data transfer.
foundVISA = visadevlist;
resourceID = foundVISA(foundVISA.Model == "N9030A",:).ResourceName;
resourceID = resourceID(contains(resourceID,"N9030A"));  
sigAnalyzerObj = visadev(resourceID);
sigAnalyzerObj.ByteOrder = "big-endian";
sigAnalyzerObj.Timeout = 20;

Next, we reset the instrument to a known state using the appropriate standard command for programmable instruments (SCPI). Query the instrument identity to ensure the correct instrument is connected.

writeline(sigAnalyzerObj,"*RST");
instrumentInfo = writeread(sigAnalyzerObj,"*IDN?");
fprintf("Instrument identification information: %s",instrumentInfo);

The X-Series signal and spectrum analyzers perform IQ measurements as well as spectrum measurements. In this example, we acquire time domain IQ data, visualize the data using MATLAB, and perform signal analysis on the acquired data. To configure instrument settings like center frequency and triggering properties and to define the format of data transfer, you can use SCPI commands as detailed in this example. Once the instrument is set up, we are ready to acquire the waveform.

To acquire the IQ waveform, we need to first trigger the instrument to make the measurement and wait for the measurement operation to complete. Before processing the data, we will separate the I and Q components from the interleaved data that is received from the instrument and create a complex vector in MATLAB as shown in the code sample below.

As a first step towards analyzing the received waveform, we can capture and display the information about the most recently acquired data to see how many points we acquired and the maximum and minimum values of the signal.

% Trigger the instrument and initiate measurement
writeline(sigAnalyzerObj,"*TRG");
writeline(sigAnalyzerObj,":INITiate:WAVeform");

% Wait until measure operation is complete
measureComplete = writeread(sigAnalyzerObj,"*OPC?");

% Read the IQ data
writeline(sigAnalyzerObj,":READ:WAV0?");
data = readbinblock(sigAnalyzerObj,"double");

% Separate the data and build the complex IQ vector
inphase = data(1:2:end);
quadrature = data(2:2:end);
rxWaveform = inphase+1i*quadrature;
writeline(sigAnalyzerObj,":FETCH:WAV1?");
signalSpec = readbinblock(sigAnalyzerObj,"double");

% Display the measurement information
captureSampleRate = 1/signalSpec(1);
fprintf("Sample Rate (Hz) = %s",num2str(captureSampleRate));

Sample Rate (Hz) = 15360000

fprintf("Number of points read = %s",num2str(signalSpec(4)));

Number of points read = 307201

fprintf("Max value of signal (dBm) = %s",num2str(signalSpec(6)));

Max value of signal (dBm) = -39.0019

Min value of signal (dBm) = -107.9755

fprintf("Min value of signal (dBm) = %s",num2str(signalSpec(7)));

Next, we use the code below to plot the spectrum of the acquired waveform to confirm the bandwidth of the received signal. Figure 6 shows that the signal bandwidth transmitted OTA looks very similar to the bandwidth signal that we generated using the Wireless Waveform Generator app.

% Ensure rxWaveform is a column vector
if ~iscolumn(rxWaveform)
    rxWaveform = rxWaveform.';
end

% Plot the power spectral density (PSD) of the acquired signal
spectrumPlotRx = dsp.SpectrumAnalyzer;
spectrumPlotRx.SampleRate =  captureSampleRate;
spectrumPlotRx.SpectrumType = "Power density";
spectrumPlotRx.PowerUnits =  "dBm";
spectrumPlotRx.Window = "Hamming";
spectrumPlotRx.SpectralAverages = 10;
spectrumPlotRx.YLimits = [-140 -90];
spectrumPlotRx.YLabel = "PSD";
spectrumPlotRx.ShowLegend = false;
spectrumPlotRx.Title = "Received Signal Spectrum: 10 MHz 5G NR-TM Waveform";
spectrumPlotRx(rxWaveform);
A screenshot of the spectrum of a received signal after OTA transmission.

Figure 6. Spectrum of received signal after OTA transmission.

Now we are ready to perform additional measurements on the received IQ data.

section

Perform Measurements of Received 5G Waveform

After the signal is transmitted over the air, the receiver subsystem is used to detect the signal and then demodulate and decode it. Before the receiver can decode the signal, channel estimation and equalization is used to combat the effects of signal fading due to multiple paths to the receiver. Demodulation reference signals (DM-RS) are used for channel estimation. Once the signal is demodulated, it is further decoded to reconstruct the original text, video, or voice signal.

First, use the generateWaveform function of the hNRReferenceWaveformGeneratorhelper file to extract the waveform information for the same specific NR-TM we generated using the Wireless Waveform Generator app.

% Set the NR-TM parameters for the receiver
nrtm = "NR-FR1-TM3.1"; % Reference channel
bw   = "10MHz";        % Channel bandwidth
scs  = "30kHz";        % Subcarrier spacing
dm   = "FDD";          % Duplexing mode
tmwavegen = hNRReferenceWaveformGenerator(nrtm,bw,scs,dm);
[~,tmwaveinfo,resourcesInfo] = generateWaveform(tmwavegen);

We then look for coarse frequency offsets in increments of 1 kHz up to 100 kHz using demodulation reference symbols (DM-RS).

frequencyCorrectionRange = -100e3:1e3:100e3; 

[rxWaveform, coarseOffset] = DMRSFrequencyCorrection(rxWaveform,captureSampleRate,… 

frequencyCorrectionRange,tmwavegen,resourcesInfo); 

fprintf("Coarse frequency offset = %.0f Hz", coarseOffset) 

Now we look for fine frequency offsets using DM-RS offsets in increments of 5 Hz up to 100 Hz.

frequencyCorrectionRange = -100:5:100; 

[rxWaveform, fineOffset] = DMRSFrequencyCorrection(rxWaveform,captureSampleRate,frequencyCorrectionRange,tmwavegen,resourcesInfo); 

fprintf("Fine frequency offset = %.1f Hz", fineOffset) 

EVM Measurements

We use the hNRPDSCHEVM helper function to analyze the waveform. The function performs these steps:

  • Synchronizes the DM-RS over one frame for frequency division duplexing (FDD), two frames for time division duplexing (TDD)
  • Demodulates the received waveform
  • Estimates the channel
  • Equalizes the symbols
  • Estimates and compensates for common phase error (CPE)

With the code below, we define the configuration settings for the hNRPDSCHEVM function and output the results.

cfg = struct();
cfg.PlotEVM = true;                 % Plot EVM statistics
cfg.DisplayEVM = true;              % Print EVM statistics
cfg.Label = nrtm;                   % Set to TM name of captured waveform
cfg.SampleRate = captureSampleRate; % Use sample rate during capture

[evmInfo,eqSym,refSym] = hNRPDSCHEVM(tmwavegen.Config,rxWaveform,cfg);

We then calculate the EVM of the resulting signal. We plot the RMS and peak EVMs per OFDM symbol, slot, and subcarrier. We also calculate the overall EVM (RMS EVM averaged over the complete waveform). Note that EVM at the DC subcarrier is also computed. Depending on your implementations, you may have to discard that subcarrier in the overall signal quality assessments.

Looking at the EVM measurements over each resource element of the resource grid, we notice that we have reasonably low distortion at each subcarrier and OFDM symbol. The constellation plot also confirms that the resulting 16QAM signals can be easily demodulated and decoded.

The measurements show that the demodulation of the received waveform is successful. The interference from the DC component of the spectrum analyzer to the DC subcarrier causes high EVM values in the measurements. Two helper functions (DMRSFrequencyCorrection and referenceGrid) were used to assist in processing the 5G waveform. These helper functions are included in the full example code.

section

Summary

MATLAB makes it easy to design and test your wireless systems. With the Wireless Waveform Generator app and 5G Toolbox, you can generate 5G and other standards-based signals to simulate your 5G communication system in MATLAB without writing any code. Once you have optimized your simulation, Instrument Control Toolbox and the Wireless Waveform Generator app let you test your wireless system over the air (OTA) under real-world conditions using standard RF test equipment.

Finally, you can perform receiver operations and analyze signals in MATLAB by computing quality metrics such as EVM to verify your designs. MathWorks tools let you focus on your design iterations and optimizations and help you accelerate your design from early-stage research through to production.