File Exchange

image thumbnail

LTE System Toolbox 5G Library

Simulate 3GPP 5G radio technologies


Updated 24 May 2018

5G Library for LTE System Toolbox (version
The 5G Library for LTE System Toolbox enables you to explore the behavior and performance of 5G radio access technologies as defined by the Release 15 3GPP NR standard V15.0.

Using this library, you can simulate the following aspects of 5G:

5G NR PDSCH Transport Channel
• Code block segmentation and de-segmentation
• LDPC channel coding
• Rate matching and recovering

5G NR Polar Coding
• CRC-Aided Polar (CA-Polar) coding for control and broadcast channels
• Rate matching and recovering

TR 38.901 Propagation Channels
• Tapped delay line (TDL) channel model
• Clustered delay line (CDL) channel model

Physical Channels and Signals Generation
• PDSCH slot and minislot allocations and DM-RS
• Configurable SS burst set (PSS/SSS/PBCH/PBCH DM-RS)

OFDM Waveforms with NR Subcarrier Spacings
• NR subcarrier spacings and frame numerologies
• Cyclic Prefix OFDM (CP-OFDM)
• Spectrum shaping techniques including windowing, WOLA (W-OFDM) and filtering (F-OFDM)

The 5G Library for LTE System Toolbox includes the following reference examples:
• 3GPP 5G NR PDSCH Throughput Simulation
• 5G Polar Coding
• 5G Waveform Spectral Analysis

Comments and Ratings (37)

@Amit Thank you for you answer Amit. I understand the way this was intended to work. I am currently working on a 5G simulation framework and I was using only a few functions from your 5G library (only encoding/decoding and rate matching/recovery actually, the rest I implemented myself) and didn't realize CRC and filler bits were assumed present in the input.

qingshan yang

i can't install the LTE System Toolbox 5G Library

Amit Kansal

@Rakesh: I will respond to your question directly via email. There seems to be an error in the choice of the CRC length for the selected code parameters which results in some bit differences in the back-to-back set up.

@Joffrey: Thanks for raising the difference in implementation. h5gLDPCEncode assumes its input to be a code block segment – with CRC and filler bits appended, and *not* just the information bits as you have considered. For this reason, the lifting size *can* be simply inferred from the input number of rows. Hope this helps your understanding of the current implementation. For the use of the functions in a full link (DL-SCH and PDSCH) simulation, please refer to the NewRadio5GLinkExample.m script.

'h5gRateRecoverLDPC' is not giving the code word back with no added noise. It is giving a code word of larger size

Hello! While using this library I noticed an issue with the LDPC coding. The way the lifting size is chosen for the encoder in h5gLDPCEncode.m doesn't match the 3GPP specs and doesn't match the way the lifting size is chosen on the decoder size.
It may also lead to errors for some inputs size because the lifting size Zc is simply chosen as size(in, 1)/22 for basegraph 1 for instance.
For this reason LDPC encoding -> rate matching -> rate recovery -> decoding doesn't work even at infinite SNR.
I fixed this issue and upload the file to my profile, in case you want to check it out to fix the issue.
Here is the direct link

Here is the direct link, as it seems not to appear on my profile

Yes, the rate recovery technique used in the 5G Library is a simplified version of that used in the LTE Toolbox and there is no soft combining of the received LLR, in the case of repetitions due to the overall code rate. There is soft combining of the entire codewords across redundancy versions but not a bit level, for reps within a codeword. In the case of the Library, this was done to keep the code simpler. Specific receiver algorithms are not defined in the 3GPP standard (beyond L1-L3 UE reception procedures), only overall system performance/conformance requirements.

hongzhi chen

Hi there, one question about the rate-recovery, in the LTE rate recovery, the function will '(additively combining any repetitions)' but in the 5G library version, we just cut the repeated parts (I'm using 2018a).
So can you please tell me why is it different from 4G to 5G? I just found the 3GPP document for transmitter side (matching) not for the recovery i.e. receiver side.

The 5G NR throughput simulation is implicitly recording the transport block BLER/PER via the blkCRC variable (this indicates whether each block (including retransmissions) was received in error or not) then scaling it by the block sizes to calculate the Mbps throughput.

Bernice Han

how can we calculate the bit error rate and packet error rate using the 3GPP 5G NR PDSCH Throughput Simulation ? Thanks

Regarding the runtime error that you found in the polar decoding, we'd need the full calling code used. It would be best to contact MathWorks through the main customer support channels so that we could get more details from you.

hongzhi chen

Hi there, I got some error for polar decoding shown as:
Index in position 2 is invalid. Array indices must be positive integers or logical
can you tell me how to fix it?

To clarify the download, installation and versioning used for the 5G Library, each release of MATLAB is associated with a different version of the 5G Library.

If you are using MATLAB R2018a then version of the 5G Library will be downloaded and installed (assuming that you have a licence to LTE System Toolbox, of course).

MATLAB R2018a will install 5G Library
MATLAB R2017b will install 5G Library
MATLAB R2017a will install 5G Library

In brief summary, to use the latest version of the 5G Library, you need the latest release of MATLAB.


Ryan (view profile)

Why the version I installed is 17.2.0, not

Is version 1.2 compatible with Matlab 2017b?


BT (view profile)

I can not get LTE System Toolbox

Ivan Trenchev

Thanks for the report, Yaqub. This is a known typo and will be fixed imminently.

Yaqub Maqdisi

There's an error in the LDPC base matrix generation. There are no QC matrices with Z=114. That should be replaced by 144.

Regarding the previous question about BER in the 5G NR link example, I believe this was answered through MathWorks technical support. The underlying issue is the relationship between channel Doppler, simulation length, and also the HARQ processes. For high SNR, the number of simulation frames will need to be increased to capture realistic BLER, especially for low Doppler where the frequency of deep fades will be low. Multiple HARQ retransmissions will also lower the observed BLER, however the percentage throughput will also lower too.

Can someone help with the BER of this example (NewRadio5GLinkExample.m), the result I am getting/seeing is not making sense... BER returns zero after 9dB SNR and beyond irrespective of the channel models run.

zhihui jing

zhihui jing

How can I get LTE System Toolbox

r.n. tsai

it does look like the library is different under R2017a vs R2017b...I'm not sure what "version 1.0" means in this case....that's too bad because R2017b is more buggy than R2017a from my experience

Shipeng Zhu

The file in 2017a and 2017b is different?Cannot find polarcode in 2017a but can find in 2017b

r.n. tsai

It doesn't look like this library has support for LDPC channel coding (the webinar seems to imply that it does...but I don't see it anywhere in the library or demos)

yun zhao

yun zhao


Darel (view profile)

If you are asking: "Does this support package work on Linux?", then the answer is yes. You just have to have a current MATLAB license with LTE System Toolbox on it.

Michael Chen

Does there has Installer file for linux?

Ken Karnofsky

To use the 5G library, you must have the latest version of LTE System Toolbox. If you don't have a license for LTE System Toolbox, you can visit and click Trial Software to request a trial.

After you install LTE System Toolbox, click Get Add-ons and select the 5G library.

How can i get LTE toolbox?

Jyotish Robin

Sun Zhennian


Ryan (view profile)

What happens if I have no license for LTE System Toolbox?

John Wang

It is the 5G Library from MathWorks.

MATLAB Release Compatibility
Created with R2017a
Compatible with R2017a to R2018a
Platform Compatibility
Windows macOS Linux

MATLAB Online Live Editor Challenge

View the winning live scripts from faculty and students who participated in the recent challenge.

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video