EXP No.
6: DEVELOPMENT OF 5G NEW RADIO POLAR CODING &
CODING:
Date : DECODING
POLAR CODE ENCODING:
s = rng (100); % Seed the RNG for repeatability AIM:
%Specify the code parameters used for a simulation. To develop a MATLAB program for 5G NR Polar Coding and Decoding.
% Code parameters APPARATUSREQUIRED:
K = 54; % Message length in bits, including CRC, K > 30 Hardware: Personal computer
E = 124; % Rate matched output length, E <= 8192 Software: MATLAB software, 5GTool box, knowledge of polar codes and the 5G
NR standard.
EbNo = 0.8; % EbNo in dB
L = 8; % List length, a power of two, [1 2 4 8] PROCEDURE:
numFrames = 10; % Number of frames to simulate 1. Start the MATLAB 2023a
linkDir = 'DL'; % Link direction: downlink ('DL') OR uplink ('UL') 2. Open M file
if strcmpi(linkDir,'DL') 3. Type the program
% Downlink scenario (K >= 36, including CRC bits) 4. Save in the current Directory
crcLen = 24; % Number of CRC bits for DL, Section 5.1, [6] 5. Compile and Run the Program
poly = '24C'; % CRC polynomial
6. If any error occurs in the program correct and run it again
nPC = 0; % Number of parity check bits, Section [Link], [6]
7. For the output see current window/ Figure window
nMax = 9; % Maximum value of n, for 2^n, Section 7.3.3, [6]
Stop the Program
iIL = true; % Interleave input, Section [Link], [6]
THEORY:
iBIL = false; % Interleave coded bits, Section [Link], [6]
else Polar codes are error-correcting codes used in the control channels of the 5G NR standard.
% Uplink scenario (K > 30, including CRC bits) Polar coding involves two main processes: encoding and decoding.
crcLen = 11; Define your Polar codes: Define the length of your codeword, code rate, and the
poly = '11'; construction type for Polar codes. In 5G NR, various code lengths and rates are used for
nPC = 0; different control and data channels. You can use the MATLAB Communications System
nMax = 10; Toolbox for encoding and decoding Polar codes.
iIL = false;
Polar Encoder: Use the [Link] object in MATLAB to create a Polar
iBIL = true;
encoder for your specified parameters. Here's an example of how you can create a Polar
end
encoder:
%Polar Encoding
R = K/E; % Effective code rate encode your message: Generate your message bits and encode them using the Polar
bps = 2; % bits per symbol, 1 for BPSK, 2 for QPSK encoder you created.
EsNo = EbNo + 10*log10(bps);
Polar Decoder: Create a Polar decoder to decode the received bits. You can use the
snrdB = EsNo + 10*log10(R); % in dB [Link] object in MATLAB:
noiseVar = 1./(10.^(snrdB/10));
% Channel Simulate the Channel: Simulate the transmission through a binary symmetric channel (BSC)
chan = [Link]('NoiseMethod','Variance','Variance',noiseVar); or any other channel model you prefer. The channel introduces errors into the received bits.
%polor decoding
Decode the received bits: Decode the received bits using the Polar decoder:
% Error meter
ber = [Link]; Evaluate the Performance: Calculate the bit error rate (BER) or any other performance metrics
numferr = 0; to assess the effectiveness of your Polar coding implementation.
for i = 1:numFrames The selection of polar codes as the channel coding technique for control channels for 5G
NR communications systems. Based on the concept of channel polarization, this new coding
% Generate a random message family is capacity achieving as opposed to just capacity approaching. With better or
msg = randi([0 1],K-crcLen,1); comparable performance than LDPC and turbo codes, it supersedes the tail-biting
convolutional codes used in LTE systems for control channels. It is applied for downlink and
% Attach CRC uplink control information (DCI/UCI) for the enhanced mobile broadband (eMBB) use case,
msgcrc = nrCRCEncode(msg,poly); as well as the broadcast channel (BCH). Alternatively, the channel coding scheme for data
channels for eMBBis specified to be flexible LDPC for all block sizes.
% Polar encode
3GPP has selected polar codes as the error correcting code on the 5G NR control channels.
encOut = nrPolarEncode(msgcrc,E,nMax,iIL);
Polar codes are unique in the way they split the channel into good and bad bit-channels.
N = length(encOut);
Consider a polar code where K information bits are being sent in a block of N bits. Polar
% Rate match code encoding will polarize the channel into reliable and unreliable bit-channels. The
modIn = nrRateMatchPolar(encOut,K,E,iBIL); information bits will be transmitted on the most reliable K bit-channels. The remaining N-
K channels are unreliable are usually set to 0 as they are not reliable for data transmission.
% Modulate
modOut = nrSymbolModulate(modIn,'QPSK');
% Add White Gaussian noise
rSig = chan(modOut);
% Soft demodulate
rxLLR = nrSymbolDemodulate(rSig,'QPSK',noiseVar);
% Rate recover
decIn = nrRateRecoverPolar(rxLLR,K,N,iBIL);
% Polar decode
decBits = nrPolarDecode(decIn,K,E,L,nMax,iIL,crcLen);
% Compare msg and decoded bits
errStats = ber(double(decBits(1:K-crcLen)), msg);
numferr = numferr + any(decBits(1:K-crcLen)~=msg);
end
disp(['Block Error Rate: ' num2str(numferr/numFrames) ...
', Bit Error Rate: ' num2str(errStats(1)) ...
', at SNR = ' num2str(snrdB) ' dB'])
rng(s); % Restore RNG
OUTPUT:
>> polarcoding1
Block Error Rate: 0, Bit Error Rate: 0, at SNR = 0.20002 dB
RESULT:
Thus a matlab program to simulate the development of 5g new radio polar coding &
decoding given specifications is written and executed.