Convolution encoder MATLAB source code

This section of MATLAB source code covers Convolution Encoder code. The same is validated using matlab built in function.

convolution encoder

Specifications

Convolution Encoder (3, 1, 4) specifications
Coding rate: 1/3
Constraint length: 5
Output bit length: 3
Message bit length: 1
Maximal memory order / no. of memory elements = 4
Generator Polynomials: 25 (8), 33 (8), 37 (8)

For basics read our article on convolution encoder implementation.


MATLAB Code

%function [Conv_out] = conv_encoder(Conv_In) 
Conv_In= [1 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1 0]; % x=[1 0 1 1 0 0 0];
m1=0;
m2=0;
m3=0;
m4=0;
%% m_in m1 m2 m3 m4
%%[1 0 1 0 1] =x0
%%[1 1 0 1 1] =x1
%%[1 1 1 1 1] =x2;

for k = 1:length(Conv_In)
%%1st polynomial
%%x0= [1 0 1 0 1]

m_in = Conv_In(k);

%first polynomial
temp1 = bitxor(m_in,m2);
x0 = bitxor(temp1,m4);

%2nd polynomial
temp1 = bitxor(m_in,m1);
temp2 = bitxor(temp1,m3);
x1 = bitxor(temp2,m4);

%3rd polynomial

temp1 = bitxor(m_in,m1);
temp2 = bitxor(temp1,m2);
temp3 = bitxor(temp2,m3);
x2 = bitxor(temp3,m4);

Conv_out((3*k)-2) = x0;
Conv_out((3*k)-1) = x1;
Conv_out(3*k) = x2;

%%%Shifiting
m4=m3;
m3=m2;
m2=m1;
m1=m_in;
end

Useful Links to MATLAB codes

Refer following as well as links mentioned on left side panel for useful MATLAB codes.
OFDM Preamble generation  Time off estimation corr  Freq off estimation corr  channel estimation  11a WLAN channel  PN sequence generation  OFDMA Tx Rx  AES DES  carrier aggregation  CCDF  FIR Filter  IIR Filter  Low Pass FIR  Viterbi decoder  CRC8 CRC32 

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR