Viterbi Decoder MATLAB Source Code

viterbi decoder
matlab code
convolutional encoder
error correction
source code

This section provides MATLAB source code for a Viterbi decoder, including specifications for a convolutional encoder with a constraint length of 5. It outlines the code snippet and steps involved in developing the Viterbi decoder MATLAB code.

Specifications of Convolutional Encoder

  • Convolutional Encoder: (3, 1, 4)
  • 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 (octal), 33 (octal), 37 (octal)

Specifications of Viterbi Decoder

  • Codeword Length: 20
  • Coding Rate: 1/3
  • Constraint Length: 5
  • Trace Back Length: 20
  • Quantization Levels: Two (Hard decision type)
  • Generator Polynomials: 25 (octal), 33 (octal), 37 (octal)

This Viterbi decoder is designed for the above convolutional encoder specifications. For more information on convolutional encoders, refer to the basics and the Convolutional Encoder MATLAB code.

Viterbi Decoder MATLAB Code STEPS

  1. STEP-1: Concatenate three consecutive bits of the received encoded sequence to form a symbol.
  2. STEP-2: Create a Transition Table for Trace Back.
  3. STEP-3: Find the length of the input and loop for the number of time units.
  4. STEP-4: Check for redundant states.

Viterbi Decoder MATLAB Code

The following is a snippet of the Viterbi decoder MATLAB code.

function [dec_op]=viterbi_decoder(rcvd)
%Concatenate three consecutive bits of received encoded sequence to
%Make up a symbol
input=[];
for j=1:3:length(rcvd)
    input=[ input (rcvd(j)* 2^2) + (rcvd(j+1) * 2^1) + (rcvd(j+2) * 2^0)];
end

%%Initialize Ouput Table
Output_Table = [
    0 0 7;
    1 7 0;
    2 3 4;
    3 4 3;
    4 5 2;
    5 2 5;
    6 6 1;
    7 1 6;
    7 3 4;
    8 4 3;
    9 0 7;
    10 7 0;
    11 6 1;
    12 1 6;
    13 5 2;
    14 2 5];

%%Initialize Next-State(Ouput State) Table
Next_State   =[
    0 0   8;
    1 0	8;
    2 1	9;
    3 1	9;
    4 2	10;
    5 2	10;
    6 3	11;
    7 3	11;
    8 4	12;
    9 4	12;
    10 5	13;
    11 5	13;
    12 6	14;
    13 6	14;
    14 7	15;
    15 7	15];

%%%%%%%%%%%%%%%%%%%
%T R A C E - B A C K
%%%%%%%%%%%%%%%%%%%
slm = min(aem(:, 21));
slm_loc =find( aem(:, 21)==slm );
sseq(21) = (slm_loc(1)-1);
for t=20:-1:1
    sseq(t) = State_Hist(sseq(t+1) + 1,t+1);
end

dec_op=[];
for k =1 : 20
    dec_op(k) = Transition_Table(sseq(k)+1, sseq(k+1)+1);
end

External Resources

Register and download the following paper for more study:

Convolutional Encoder VHDL Source Code

VHDL source code for a convolutional encoder with FEC rate 1/2, constraint length 7, and generator polynomials G1=171 (octal) and G2=133 (octal).

vhdl
convolutional encoder
source code
Telecom Interview Questions and Answers

Telecom Interview Questions and Answers

Ace your telecom job interview with these expert-prepared questions and answers on wireless systems, modulation, error correction, and more.

telecom
interview
wireless
Convolutional Encoder Example and Pseudo Code

Convolutional Encoder Example and Pseudo Code

Explore a convolutional encoder example with a 1/3 code rate and constraint length of 5. Includes pseudo code and generator polynomials.

convolutional encoder
forward error correction
channel coding