Model, Simulate, and Test 5G NR PHY in MATLAB
Overview
This webinar shows the application of 5G Toolbox™ for 3GPP5G New Radio (NR) physical layer modeling. Standards-compliant models in MATLAB® are implemented to explore the behavior of 5G physical layer systems or components. MATLAB version R2021a is used.
Highlights Include:
- Uplink and downlink 5G NR waveform generation including pre-defined (test models, FRCs) and full custom waveforms
- Modeling of 5G uplink and downlink physical channels and signals such as PDSCH/PUSCH, PDCCH/PUCCH, synchronization burst, DMRS (demodulation reference signals), CSI-RS, SRS, and PT-RS
- Channel models including those specified in TR 38.901: tapped delay line (TDL) and clustered delay line (CDL)
- Link-level simulation to measure the throughput of a downlink (PDSCH) or an uplink (PUSCH) 5G link over 2-D or 3-D channel model
- Synchronization procedures including cell search, MIB, and SIB1 decoding
- Beamforming, beam management, and precoding matrix indicator (PMI) determination
- Measurements: ACLR, EVM, CQI
About the Presenter
Marc Barberis is an application engineer with MathWorks, based in Silicon Valley, where he focuses on wireless standards such as 5G NR, LTE and WLAN. Prior to joining MathWorks, Marc worked on the modeling of telecommunications systems and the design of receivers for 2G/3G cellular phones and satellites systems among others. He attended numerous 3GPPstandardization meetings for GSM/EDGE and W-CDMA. He holds a M.S. in Signal Processing from Ecole Nationale Superieure des Telecommunications de Paris, France.
Published: 9 Apr 2024
Hello and welcome.
My name is Marc Barberis, and I am part of the Application Engineering Group at MathWorks, where I focus on our wireless standard products including 5G, LTE and WLAN. I’ve been with MathWorks for many years. At MathWorks and with prior companies, I have followed the different cellular standards from GSM through 5G, including all flavors of 2G and 3G, and 4G.
In this presentation, we will have a look at typical scenarios you may be facing in 5G projects, and we will see how 5G Toolbox helps achieve your objectives. This presentation is based on release 2024a of 5G Toolbox.
So, what are some typical scenarios you may encounter?
You may be tasked with characterizing a device under test or the RF front-end of a device for 5G applications. To that end, you need to get ahold of 5G waveforms, and those could be either off-the-shelf waveforms mentioned in the standard for testing or custom waveforms you want to define yourself to test specific aspects of the hardware.
Typical measurements here include EVM or ACLR.
Or maybe you want to analyze actual 5G waveforms that you captured live or generated in a lab or, possibly, with MathWorks 5G Toolbox.
MathWorks tools lets you grab waveforms directly over the air with an SDR or using a VSA from an instrument vendor and import them into MATLAB. Once the waveform is in MATLAB, 5G Toolbox can analyze it and, if it is a downlink waveform, perform all initial synchronization steps including frame synchronization, cell search, extraction of the master information block or MIB as well as System Information Block Type 1 or SIB1.
This flow lets you easily scan for existing 5G transmissions and detect information broadcast by base stations.
Another common task is to investigate the performance of a 5G communication link under various settings through simulation. Here, many factors come into play including:
- Detailed physical layer specifications
- Propagation channels
- Beamforming
- MU-MIMO or massive MIMO scenarios
And one typical measurement of interest is the link throughput.
These are 3 possible scenarios. There are many more, which we won’t have time to explore in detail, but we will mention some other ones later in our presentation.
This leads me to my agenda for today:
- My first 3 sections will address the previous 3 scenarios
- We will then briefly discuss a few other applications such as 6G exploration, O-RAN or AI
- Finally, we will go over key take-aways and additional resources for today’s session
Let’s start by looking at how to characterize a DUT or RF front-end.
The first piece of the solution is accessing a 5G waveform to feed to the device under test. 5G Toolbox lets you select a pre-defined waveform or a custom waveform created to your exact specifications.
The 3GPP group specified new radio test models or fixed reference channels so that everybody can compare results on standardized settings. Or you can generate full custom uplink and downlink waveforms.
The easiest way to generate those waveforms is to use the 5G Waveform Generator App. So, let’s have a look at the App in action.
I select the App tab and start the 5G Waveform Generator. I can select custom downlink, custom uplink, a test model, a downlink FRC, or an uplink FRC.
Let’s start with an uplink FRC.
You first select the frequency range of interest: FR1 for sub-7GHz or FR2 for mmW. You then pick the modulation scheme and coding rate: let’s select 64 QAM, and then one of the available FRCs with these specifications: let’s pick the last one, with 30kHz and 100 MHz bandwidth.
You can also add impairments such as phase or frequency offset [select phase offset], phase noise, or non-linearities [select memoryless cubic nonlinearity], and generate the waveform simply by clicking on the Generate button.
You can see the 100MHz spectrum of the waveform at the top. At the bottom, the OFDM grid shows that most of the time frequency resources are occupied by uplink data or PUSCH.
You can now export this waveform to the MATLAB workspace or a file [click on Export]. In that case, you can select between different formats with or without metadata. Or you can generate a MATLAB script that recreates this exact waveform [scroll through script], or a Simulink block. Alternatively, if you have an instrument or an SDR board connected, by switching to the Transmitter tab, you can configure the instrument by indicating the carrier frequency and transmission power and transmit that waveform over the air. At that point, you have successfully generated a 5G waveform, and the waveform is playing on your waveform generator. It is important to understand that the waveform generator does not need to have any 5G personality. It is simply transmitting a waveform pre-computed in MATLAB.
The principle is exactly the same for downlink FRCs or [show it] test models.
In summary, you have a great, interactive way to generate pre-defined 5G waveforms.
Next, we will generate a custom downlink waveform. You can see that there are many parameters you can set up, starting with the frequency range, bandwidth, and cell ID, but also all sorts of parameters for the synchronization burst, PDSCH, PDCCH , and CSI-RS. And this includes the CORESETs and associated search spaces. Let’s generate the waveform and the corresponding MATLAB script.
As you can see, the generated code shows you how to set up all those parameters from the command line. This makes the Wireless Waveform Generator App a great way to get started with complex 5G waveforms, even if you intend to later work with MATLAB code.
[Back to slide]
In summary, 5G Toolbox lets you quickly generate off-the shelf standard-compliant 5G waveforms. You can generate those waveforms interactively or with a script. The generated baseband I/Q waveform is unencrypted and ready for further use. But this is only the first half of the story.
This slide shows the complete flow you can adopt for your test: on the left side, you can see the part we have just gone through, which is waveform generation and transmission with an instrument. On the right side, you can see the other half, which is capturing the waveform with an instrument and sending it back into MATLAB for analysis.
This example represents a very typical flow to test a DUT. Note that there is an analogous flow shown in a separate example, where instruments are replaced with SDR boards.
What kind of analysis can you expect in 5G Toolbox? Certainly ACLR and EVM to get started. Don’t let the title fool you: this example performs both ACLR and EVM, but I will emphasize the ACLR measurement here. We will talk about EVM later.
The example first generates a 5G NR waveform, as we saw in our earlier section.
Then it upsamples and filters the waveform and computes the ACLR.
[Switch to MATLAB]
You will find the ACLR example in the test and measurement section. This is a live script, which avails us of interactive controls.
Let me run the live script [Run it and wait for it to complete].
You can see how we select the source waveform. We then design a low-pass filter that reduces emission in the adjacent bands and run two paths in parallel: one with the unfiltered waveform and one with the filtered waveform, in order to study the impact of the filter. Both waveforms then undergo a non-linearity. This non-linearity creates spectral regrowth. We compute the EVM and ACLR for the unfiltered waveform and the filtered waveform in parallel.
First, we can see that the EVM for the unfiltered waveform is very low at 0.01%. This means we must be operating in the linear region of the non-linearity. If we look at the EVM of the filtered waveform, we see that it is a bit higher, at 0.25%. This increase in EVM is attributable to the lowpass filter.
Regarding ACLR, we can see that the spectrum of the unfiltered waveform shows strong spectral regrowth right outside of the band, whereas the one of the filtered waveform exhibits a much stronger decay. Correspondingly, the filter improves the ACLR from 41dB to 71dB.
The next example is dedicated to measuring EVM on a 5G NR waveform. In this example, we generate an ideal waveform with 5G Toolbox and add a model of phase noise impairments, IQ imbalance and power amplifier non-linearities. It reports the EVM for control and data and analyzes the EVM variations over time and frequency as displayed in this 3D plot on the top right. The same example exists for the uplink as well.
So, if you remember how we started, we now have all pieces to that puzzle: you can get ahold of a 5G waveform with the Wireless Waveform Generator, transmit it with a waveform generator and stimulate your design under test, then recapture the waveform with an instrument and perform analysis such as ACLR and EVM in MATLAB.
Sometimes, you may not have access to the actual hardware to test. It may not be ready yet. In that case, you may want to model impairments in a simulated environment.
You can introduce simple impairment, some of which we saw in the Wireless Waveform Generator or the EVM example, such as simple non-linearities, phase noise or I/Q imbalance.
If you want to go beyond those impairments and look at effects such as intermodulation, leakage, S-parameters and more complex amplifier models, you can take advantage of RF simulation capabilities in our RF Blockset product.
Several examples in 5G Toolbox illustrate how to bring in those more complex impairments together with 5G waveform generation and analysis. As you can see on this slide, the RF part is modeled with RF Blockset, which works within Simulink. RF simulation here uses circuit envelope, a technique that provides much more accuracy than simpler models but runs much faster than detailed RF simulations.
I want now to move on to the second case we wanted to look at: how to analyze a live 5G waveform or, possibly, a previously recorded waveform to detect information in the waveform.
To understand what is at stake here, it may be useful to quickly review the process of initial acquisition, when a phone or UE first attempts to get on the network.
The gNB periodically transmits a synchronization signal burst, with several repetitions beamformed in different directions. The UE detects and decodes the best beam. This gives him enough information to locate and decode the next piece of information, the System Information Block Type 1 or SIB1. Once the SIB1 is decoded, the UE has gained enough information to be able to make its presence known by sending a RACH message to the base station.
So, this is how you can scan the airwaves for an existing 5G waveform: you can set up an SDR board to periodically capture a chunk of samples in the spectrum of interest and pass it to MATLAB for further analysis, before capturing another chunk of samples.
The analysis performed in this example on this slide consists in all steps necessary for the UE to acquire cell information including the master information block and system information block type 1. To make things a little more concrete, the master information block carries just a few pieces of information such as whether the cell is open or barred, the system frame number and, crucially, the location of the control information that points to the SIB1.
The SIB1 contains a long list of pieces of information, including the name of the operator, set up for random access operation and much more.
If you want to perform the same detailed analysis on a recorded waveform, you can also have a look at the example called “cell search, MIB and SIB1 recovery”. This example takes you step by step through the acquisition process.
[Switch to MATLAB]
Let us look at this example in MATLAB. You can find it under “Signal reception and recovery”.
Let me open and run the example.
We see the SSB pattern, with 8 quasi-repetitions of the original SSB, as well as 8 repetitions of something else that we will get to later.
(Show PSS correlations) On the receive side, we first perform coarse frequency correction by pre-correcting the waveform with multiples of the half-carrier spacing. You can see that the maximum is obtained for the blue curve, which corresponds to PSS = 0, and an estimated frequency offset of 0Hz, as expected as there is no frequency offset introduced here.
Now that the primary synchronization sequence has been identified, we can perform fine frequency offset correction and detect the secondary synchronization sequence:
(Show SSS correlations) It is one of the possible 336 and, at that point, the receiver has knowledge of the physical cell identity.
(Show DMRS correlations) The UE can also tell, even if it had not received any of the other SSBs, that it received the first SSB of the burst, by looking at the SNR of the DMRS sequence in that SSB. This is useful information for the gNodeB because it can reuse the same beamforming to target this UE in the future.
(Show PBCH constellation) Here, you can see the equalized constellation for the BCH. The master information block was correctly received, and the information decoded. The EVM on the BCH is about 8%.
(Show highlighted CORESET) Now that the MIB has been recovered, the UE can go after the common CORESET, and we can see that the next repeated part in the waveform is the PDCCH followed by the SIB1, which is carried by the PDSCH. (Show the strongest PDCCH & PDSCH).
Finally, the SIB1 is decoded.
And, like all examples and functions in 5G Toolbox, this example comes with full source code. For that reason, you can see anything you want in the recovery process.
And the availability of source code can be even more interesting when it comes to our third case, which is investigating the performance of an end-to-end 5G link.
Remember: we are talking here about transmission through multiple antennas, propagation with multiple paths and fading, demodulation and feedback loops such as adaptive modulation and coding, adaptive beamforming and HARQ.
Let’s start with the capabilities on the transmit side. 5G Toolbox supports all channel and signals defined in the standard. As you probably know, 3GPP comes up with a new release every year or so: the latest one is Release 18, also known as 5G Advanced. 5G Toolbox follows the evolution of the standard, and the latest release, R2024a reflects some of the latest evolution found in Releases 17 and 18, as we will are about to see.
5G Toolbox includes release 17 updates. One of the most obvious updates is the ability to generate waveforms with a bandwidth of up to 2GHz and a subcarrier spacing of up to 960kHz. But there are other noteworthy updates such as support for QAM1024 or 32 HARQ processes with application to 5G NTN.
Along the same lines, note that the 6G Exploration Library, which is part of the release 2024a of 5G Toolbox, lets you go even further, as we will see later.
Release 2024a of 5G Toolbox also includes R18 updates. Let me just point out the extension to 8 layers on the uplink as well as 8 ports for SRS. On the downlink, DMRS have been enhanced to support up to 24 ports.
The 3GPP standardization body defined channel models called tapped delay line and cluster delay line, in a document called TR 38.901. These channels come with many options and parameters, but they also come with predefined profiles called A, B, C, D, and E. 5G Toolbox offers those profiles as well as the full custom option. Release 2024a added NTN-specific profiles.
What are those TDL and CDL channels? Think of TDL as the traditional 4G or 3G channel, with a delay and power profile and each tap has a Rayleigh fading characteristic.
The CDL, on the other hand, is quite interesting because, as shown on the right side of the slide, it models clusters of rays leaving the transmit antenna, each ray being associated with a given elevation and azimuth angle; and the same happens on the receive side. Therefore, this model includes 3D propagation, and it is particularly suited for beamforming simulation. Note that the antenna model in the CDL channel is quite sophisticated, with arrays of panels of cross-polarized antenna arrays. In addition, the CDL channel model in 5G Toolbox lets you specify any type of antenna or antenna array.
The TDL and CDL channel models are extremely useful channel models. They are what is called a stochastic model and represent a type of propagation conditions. On the other hand, they are not purely geometric and never exactly match the propagation conditions of any specific location.
At the other end of the spectrum are channel models that are meant to closely reflect the propagation conditions between a transmitter and receiver at very specific locations with detailed surrounding information. This is what is called a ray-tracing channel model. You can perform ray-tracing analysis between one or several gNodeBs and one or several UEs taking into account buildings and surfaces.
The ray-tracing engine allows up to 10 reflections off the ground and buildings as well as diffraction. R2024a introduces support for multiple materials in the same scene.
Now that we know we can generate waveforms and propagation channels are available, we can continue building up our simulation and set up a complete end-to-end link.
5G Toolbox comes with fully configured end-to-end examples for each direction. On the downlink, we can see all the DLSCH and PDSCH processing stages, including waveform generation in blue, propagation, and the receive chain in red with closed-loop feedback for HARQ and precoding. At the output, we get the physical bits that were transmitted, and we can derive the throughput versus SNRs for this scenario, as shown on the right side.
This lets you investigate the performance of a 5G uplink or downlink for various levels of noise, signal bandwidths, modulation types and so forth.
Let me show you where you will find those examples in 5G Toolbox.
[Switch to MATLAB]
I bring up the 5G documentation. If we go to our list of examples, you can select the end-to-end category in the category list. The first two examples show throughput measurement for the downlink and the uplink, but there are many more scenarios that are modeled in this section. You will find multi-link examples such as this TDD MU-MIMO simulation, examples of beamforming, RACH, CSI-based reporting and more.
If I select the uplink, you can see the overview of the link. Here we see how we set up the PUSCH parameters including modulation, coding rate, DMRS type, and so forth. Scrolling all the way down to the receiver, you can see perfect or practical synchronization, followed by perfect or practical channel estimation, equalization, MIMO combining, and LDPC decoding. As a result, we can check the CRC, request retransmissions, and compute the throughput.
[Back to slide]
The final topic of this section is non-terrestrial networks or NTN. Release 17 added new capabilities in the 5G standard to better support NTN links.
This example extends the throughput capabilities to an NTN link. There are several key differences with a terrestrial link:
- The transmission channel is quite different. Two options are available. The narrowband channel and the TDL channels, which are defined in TR 38.811
- Doppler shift is much higher due to the satellite speed. Some of it can be pre-compensated in the transmitter, at least for the center of the beam, while the rest must be tackled in the receiver
- Finally, up to 32 HARQ processes are available. This higher number of processes is necessary to accommodate the higher latency of the link
This leads me to the last section of my presentation, where I want to mention a few other topics that are also part of 5G Toolbox and would each deserve a longer introduction on their own.
First, one ground-breaking new capability in R2024a of 5G Toolbox is the 6G Exploration Library. This library lets you investigate various technologies and parameters under consideration for 6G. I will not spend time on it here, because there is a separate presentation that deals with the 6G Exploration library. In a nutshell, you can go beyond 5G limitations in terms of bandwidth and carrier spacing and investigate the impact of those parameters on an end-to-end link.
In addition, the library comes with examples of RF impairments and measurements for extended bandwidths and Reconfigurable Intelligent Surfaces or RIS. Finally, R2024a also includes an example of OTFS or Orthogonal Time Frequency Space modulation, a technique that can improve performance in channels with high Doppler spread.
Next, O-RAN is a very popular topic. The ability to mix and match equipment from different vendors has motivated the need for standardized interfaces and transmission protocols at those interfaces. One popular split is called 7.2x.
5G Toolbox offers the ability to generate bit streams at the 7.2x interface including one of 3 compression techniques. You can export the bit stream to a PCAP file for analysis by a packet analyzer or verification of your own interface. Both control and user planes are supported. R2024a adds the ability to perform the reverse operation, which means analyze an existing PCAP file.
V2X is another area where 5G seems to be gathering some momentum. This example demonstrates how to simulate a V2X communication scenario and measure performance of the link for both control and data, as well as different types of HARQs.
Note that the propagation channel supports mobility at both the transmitter and receiver, which can be interesting when modeling car to car communication.
Deep Learning is an area that is showing great promise for wireless communications for applications such as scheduling, physical layer optimization, cross-layer optimizations and so forth.
5G Toolbox ships with several examples of deep learning applications, some of which are shown on this slide. You will also find examples of classification, another popular topic, for example recognizing whether the input waveform contains any 5G or LTE component.
One of the latest additions is the CSI Feedback with Auto-encoders example. This topic deserves a much longer presentation and, if you are interested, look for the webinar called Beamforming for MU-MIMO in 5G NR on the MathWorks website.
This was a topic for 3GPP in Release 18 and it is still a topic for upcoming releases: how to efficiently compress channel state information.
All these examples show a complete flow starting with data generation and automatic labeling, training, verification, and deployment.
One new example in release 2024a is the use of AI for positioning accuracy enhancement. The scenario compares positioning accuracy with AI or time difference of arrival techniques both for line of sight and non-line-of-sight scenarios.
While 5G Toolbox is primarily focused on the physical layer, you will find an increasing number of examples that address the larger problem of system-level simulation.
The main objective of those larger simulations is to estimate the throughput at the cell level as opposed to a single link. 5G Toolbox offers unique capabilities in this area as you will find examples with full physical layer simulations, which provide the greatest accuracy, and abstracted PHY, which provides higher simulation speed.
For abstracted PHY, enough physical layer is modeled to accurately measure the SINR of each receive link. Then performance is predicted based on knowledge of link performance under various transmission conditions and SINR. This simulation is quite accurate but does not require full modeling of the PHY with detailed coding and equalization.
We spoke earlier of the TDL and CDL channel models from TR 38.901. TR 38.901 also defines a system-level channel model, which is used is these simulations to represent the links between the gNodeBs and UEs. This includes specific scenarios, sectorized cells, and much more.
What are the key takeaways from this presentation? Some should be clear by now, and some I want to make here.
First, we have looked in some detail at those 3 scenarios:
- How to characterize a DUT or RF front-end
- How to analyze a live 5G waveform
- And how to simulate the performance of an end-to-end 5G link
We have seen how 5G Toolbox along with other MathWorks tools can play a crucial role in solving those challenges.
So, what are the main benefits of 5G Toolbox:
5G Toolbox includes 5G-specific functions and examples, and we have seen some of them in this presentation.
It comes with extensive documentation. Because it is meant to be used by people who did not write the Toolbox.
It is verified against external sources.
And it includes full MATLAB source code. Concretely, this means that if you look at any example and open any function in the Toolbox, you can see the source code all the way to the leaf level.
For those of you who want to get up to speed on the standard, I want to highlight our great 2-day class that covers the 5G physical layer in detail. You can see a link to the class on this slide.
Let me conclude this presentation by highlighting three key facts about 5G Toolbox.
First, you can easily generate 5G NR waveforms, either off the shelf or custom
Second, 5G Toolbox comes with complete examples for end-to-end links, synchronization and measurements, as well as additional topics beyond the physical layer.
Third, you have full MATLAB source code for everything in the toolbox
And, of course, we have done the hard work of verification, which lets you focus on what matters to you.
If you want to learn more about 5G Toolbox, visit our 5G Toolbox page at mathworks.com/products/5g.
You will find information about all topics, with links to examples, videos and additional resources.
Sign up for our training class or watch related webinars shown on this slide.