Azzera filtri
Azzera filtri

Convolutional Coding/Decoding Using Matlab Functions

29 visualizzazioni (ultimi 30 giorni)
I'm trying to perform convolutional coding/decoding using built in Matlab functions. I'm trying to implement (2,1,3) code.
K=3;
G1=7;
G2=5;
msg=[1 1 0 0 1 0];
trel=poly2trellis(K,[G1 G2]);
coded=convenc(msg,trel);
decoded=vitdec(coded,trel,5*K,'cont','hard');
coded=[1 1 0 1 0 1 1 1 1 1 1 0]
decoded=[0 0 0 0 0 0]
As you would expect, the decoded message should be the same as msg, which it is not. I don't see where I have gone wrong in this simple example.
  2 Commenti
amjad ali
amjad ali il 14 Nov 2015
Modificato: Walter Roberson il 14 Nov 2015
use the following :
K=3;
G1=7;
G2=5;
msg=[1 1 0 0 1 0]
trel=poly2trellis(K,[G1 G2]);
coded=convenc(msg,trel);
tblen = length(msg);
decoded=vitdec(coded,trel,tblen,'trunc','hard')
Amit Kansal
Amit Kansal il 9 Giu 2021
Modificato: Amit Kansal il 9 Giu 2021
Amjad's response above is right for the case highlighted.
For the vitdec function, the "cont" (continuous) mode of operation incurs a delay which is why the decoded output has zeros. In the "trunc" (truncated mode), each frame is treated independently and there is no delay incurred in the output. Depending on ones use case (streaming or batch mode), either operation mode may be applicable.

Accedi per commentare.

Risposta accettata

Amit Kansal
Amit Kansal il 24 Giu 2021
For the vitdec function, the "cont" (continuous) mode of operation incurs a delay which is why the decoded output has zeros.
In the "trunc" (truncated mode), each frame is treated independently and there is no delay incurred in the output.
Therefore, use the following instead:
K = 3;
G1 = 7;
G2 = 5;
msg = [1 1 0 0 1 0]
trel = poly2trellis(K,[G1 G2]);
coded = convenc(msg,trel);
tblen = length(msg);
decoded = vitdec(coded,trel,tblen,'trunc','hard')
For outputs to match the input msg as shown below.
msg =
1 1 0 0 1 0
decoded =
1 1 0 0 1 0
  3 Commenti
Amit Kansal
Amit Kansal il 2 Ago 2021
Hello Anees,
Both convenc and vitdec functions are offered with Communications Toolbox. As a result, to be able to use these functions, you would need to have the Communications Toolbox as well on top of base MATLAB.
Hope this helps,
Amit

Accedi per commentare.

Più risposte (2)

Muhammad Haris Khan
Muhammad Haris Khan il 26 Nov 2019
I'm trying to perform convolutional coding. Kindly share MAtlab code for Part 1. Conv Encoder.
This block encodes the random bit vector u into a (longer) bit vector c. We assume that the convolutional
encoder is not zero-terminated. In this project, we use the following different encoders:
• E1: Rate-1/2 convolutional encoder, generator polynomial G = (1 + D2, 1 + D + D2)
Conv .JPG
  1 Commento
Amit Kansal
Amit Kansal il 9 Giu 2021
You can use
trellis = poly2trellis(3, [5 7]);
convenc(msg, trellis)
to encode a binary msg. In the trellis specification, the [5 7] corespond to the [1+D2, 1+D+D2] polynomials in octal notation.

Accedi per commentare.


selva ganesh
selva ganesh il 13 Set 2022
K=3;
G1=7;
G2=5;
msg=[1 1 0 0 1 0];
trel=poly2trellis(K,[G1 G2]);
coded=convenc(msg,trel);
decoded=vitdec(coded,trel,5*K,'cont','hard');
coded=[1 1 0 1 0 1 1 1 1 1 1 0]
decoded=[0 0 0 0 0 0]

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by