Documentation

nrPolarEncode

Polar encoding

Description

example

enc= nrPolarEncode(in,E)returns the polar-encoded output for the input messageinand rate-matched output lengthEas 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 2nmaxand input interleaving specified byiil.

  • For downlink (DL) configuration, valid values fornmaxandiilare 9 andtrue, respectively.

  • For uplink (UL) configuration, valid values fornmaxandiilare 10 andfalse, respectively.

Examples

collapse all

Perform polar encoding of a random message of lengthK.Especifies the length of the rate-matched output which is different from the length of the encoded messageenc. The length ofencis always a power of two.

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

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

Initial Setup

Create a channel that adds white Gaussian noise (WGN) to an input signal. Set the noise variance to 1.5.

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

Create a binary phase shift keying (BSPK) modulator and demodulator.

bpskMod = comm.BPSKModulator; bpskDemod = comm.BPSKDemodulator('DecisionMethod',...'Approximate log-likelihood ratio','Variance',nVar);

Simulate a Frame

Perform polar encoding of a random message of lengthK. The rate-matched output is of lengthE.

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

Modulate the polar encoded data using BSPK modulation, add WGN, and demodulate.

mod = bpskMod(enc); rSig = chan(mod); rxLLR = bpskDemod(rSig);

Perform polar decoding using successive-cancellation list decoder of lengthL.

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

Determine the number of bit errors.

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

The transmitted and received messages are identical.

Input Arguments

collapse all

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

Data Types:double|int8

Rate-matched output length in bits, specified as a positive integer.Edepends onK, the length of the input messagein.

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

  • IfK> 30,Emust be in the rangeK<E≤ 8192.

Data Types:double

Base-2 logarithm of the encoded message's maximum length, specified as9or10.

  • For DL configuration, specify9.

  • For UL configuration, specify10.

IfNis the length of the polar-encoded message in bits, thenN2nmax. See TS 38.212 Section 5.3.1.2[1].

Data Types:double

Input interleaving, specified astrueorfalse.

  • For DL configuration, specifytrue.

  • For UL configuration, specifyfalse.

Data Types:logical

Output Arguments

collapse all

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

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..

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2018b