# nrPolarEncode

Polar encoding

Since R2018b

## Description

example

enc = nrPolarEncode(in,E) returns the polar-encoded output for the input message in and rate-matched output length E as specified in TS 38.212 Section 5 [1]. By default, input interleaving is enabled and the maximum length of the encoded message is 512. Use this syntax for downlink configuration.

enc = nrPolarEncode(in,E,nmax,iil) encodes the input with a specified maximum length of 2nmax and input interleaving specified by iil.

• For downlink (DL) configuration, valid values for nmax and iil are 9 and true, respectively.

• For uplink (UL) configuration, valid values for nmax and iil are 10 and false, respectively.

## Examples

collapse all

Perform polar encoding of a random message of length K. E specifies the length of the rate-matched output which is different from the length of the encoded message enc. The length of enc is always a power of two.

K = 132;
E = 300;
msg = randi([0 1],K,1,'int8');
enc = nrPolarEncode(msg,E)
enc = 512x1 int8 column vector

0
0
0
0
0
0
1
1
1
0
⋮

Transmit polar-encoded block of data and decode the data using successive-cancellation list decoder.

Create an additive white Gaussian noise (AWGN) channel with a noise variance of 1.0.

nVar = 1.0;
chan = comm.AWGNChannel('NoiseMethod','Variance','Variance',nVar);

Perform polar encoding of a random message of length K. The rate-matched output is of length E.

K = 132;
E = 256;
msg = randi([0 1],K,1,'int8');
enc = nrPolarEncode(msg,E);

Modulate the polar encoded data.

mod = nrSymbolModulate(enc,'QPSK');

Send the modulated data through the AWGN channel.

rSig = chan(mod);

Soft-demodulate.

rxLLR = nrSymbolDemodulate(rSig,'QPSK',nVar);

Perform polar decoding using successive-cancellation list decoder of length L.

L = 8;
rxBits = nrPolarDecode(rxLLR,K,E,L);

Determine the number of bit errors induced by the AWGN channel.

numBitErrs = biterr(rxBits,msg);
disp(['Number of bit errors: ' num2str(numBitErrs)])
Number of bit errors: 0

## Input Arguments

collapse all

Input message, specified as a column vector of binary values. in includes the CRC bits if applicable.

Data Types: double | int8

Rate-matched output length in bits, specified as a positive integer. E depends on K, the length of the input message in.

• If 18 ≤ K ≤ 25, E must be in the range K + 3 < E ≤ 8192.

• If K > 30, E must be in the range K < E ≤ 8192.

Data Types: double

Base-2 logarithm of the encoded message's maximum length, specified as 9 or 10.

• For DL configuration, specify 9.

• For UL configuration, specify 10.

If N is the length of the polar-encoded message in bits, then N2nmax. See TS 38.212 Section 5.3.1.2 [1].

Data Types: double

Input interleaving, specified as true or false.

• For DL configuration, specify true.

• For UL configuration, specify false.

Data Types: logical

## Output Arguments

collapse all

Polar-encoded message, returned as a column vector of binary values. enc inherits its data type from the input message in.

The length of the polar-encoded message, N, is a power of two. For more information, see TS 38.212 Section 5.3.1.

• For DL configuration, N ≤ 512.

• For UL configuration, N ≤ 1024.

Data Types: double | int8

## References

[1] 3GPP TS 38.212. “NR; Multiplexing and channel coding.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network..

## Version History

Introduced in R2018b