Polar coding algorithms in Matlab


This webpage provides the Matlab code of various polar coding algorithms ranging from polar code design to encoding and decoding.
The algorithms are either direct implementations of the standard polar coding literature or they are Matlab implementions of the pseudo-code presented in the papers below.

Recent publications
  1. H. Vangala, E. Viterbo, and Yi Hong,  "Efficient systematic polar encoding", IEEE Communication Letters, 2015.
  2. H. Vangala, E. Viterbo, and Yi Hong,  "A Comparative Study of Polar Code Constructions for the AWGN Channel", Jan. 2015.
  3. H. Vangala, E. Viterbo, and Yi Hong,  "A new multiple folded successive cancellation decoder for polar codes", Information Theory Workshop, ITW 2014, Hobart, Tasmania , Nov. 2014.
  4. H. Vangala, E. Viterbo, and Yi Hong,  "Permuted successive cancellation decoder for polar codes", International Symposium on Information Theory and its Applications, ISITA 2014, Melbourne , Oct. 2014.
  5. H. Vangala, E. Viterbo, and Yi Hong,  "Improved Multiple Folded Successive Cancellation Decoder for Polar Codes", General Assembly and Scientific Symposium (URSI GASS), Beijing , Aug. 2014.

Matlab codes

We have created a MATLAB module that has all the components of polar codes. More specifically, we have implemented following components in full detail.

The full module can be downloaded as a zip archive from this link [download]

The system model and various functions can be visualized using the below block digram.


block diagram of polar coding and corresponding functions

Installation

The code is a standalone directory. It can simply be copied/sourced directly into the current working directory of MATLAB.

Alternatively you may add the full path of the extracted directory to your MATLAB path. This is more flexible that
you may call the polar coding routines from any working directory.

No other installation is required. One can instantly start working with polar coding modules.

Working Examples
INITIALIZATION:

>> N=128; K=64; Ec=1; N0=2; %0dB SNR

>> initPC(N,K,Ec,N0);

 All polar coding parameters/resources initialized. (in a global structure - "PCparams")
              N: 128
              K: 64
              n: 7
       FZlookup: [128x1 double]
             Ec: 1
             N0: 2
            LLR: [1x255 double]
           BITS: [2x127 double]
    designSNRdB: 0

STANDARD POLAR CODING:

>> u= (rand(K,1)>0.5); %message

>> x= pencode(u); % POLAR ENCODING

>> y= (2*x-1)*sqrt(Ec) + sqrt(N0/2)*randn(N,1); %AWGN

>> u_decoded= pdecode(y); %SUCCESSIVE CANCELLATION DECODING

>> logical(sum(u==u_decoded)) %Check if properly decoded

ans =

     1

SYSTEMATIC POLAR CODING:

>> x_systematic = systematic_pencode(u);
%optional, extra argument is the encoder-name: 'A'(default) or 'B' or 'C'

>> y= (2*x-1)*sqrt(Ec) + sqrt(N0/2)*randn(N,1); %AWGN

>> u_decoded= systematic_pdecode(y);

>> logical(sum(u==u_decoded))

ans =

     1

PLOTTING THE PERFORMANCE CURVES:

>> N=128; K=64; EbN0range=0:0.4:2; designSNRdB=0;

>> plotPC(N,K,EbN0range,designSNRdB,0); %last argument says no VERBOSE-output
Completed SNR points (out of 6):
 0.00 dB (time taken:27.69 sec)
 0.40 dB (time taken:27.18 sec)
 0.80 dB (time taken:27.18 sec)
 1.20 dB (time taken:27.16 sec)
 1.60 dB (time taken:27.10 sec)
 2.00 dB (time taken:40.55 sec)

 Eb/N0 range (dB) :          0    0.4000    0.8000    1.2000    1.6000    2.0000

 Frame Error Rates:     0.7080    0.5930    0.4790    0.3730    0.2400    0.1342

 Bit Error Rates  :     0.2311    0.1776    0.1393    0.1012    0.0646    0.0317

>> plotPC_systematic(N,K,EbN0range,designSNRdB,0); %last argument says no VERBOSE-output
Completed SNR points (out of 6):
 0.00 dB (time taken:31.66 sec)
 0.40 dB (time taken:31.68 sec)
 0.80 dB (time taken:31.84 sec)
 1.20 dB (time taken:31.71 sec)
 1.60 dB (time taken:31.94 sec)
 2.00 dB (time taken:45.58 sec)

 Eb/N0 range (dB) :          0    0.4000    0.8000    1.2000    1.6000    2.0000

 Frame Error Rates:     0.7400    0.6050    0.4620    0.3140    0.2430    0.1395

 Bit Error Rates  :     0.1223    0.0906    0.0649    0.0386    0.0276    0.0142


Last modified by Harish Vangala and Emanuele Viterbo on 17/11/2015