Convolutional Coding/Decoding Using Matlab Functions

29 次查看(过去 30 天)
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 个评论
amjad ali
amjad ali 2015-11-14
编辑:Walter Roberson 2015-11-14
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 2021-6-9
编辑:Amit Kansal 2021-6-9
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.

请先登录,再进行评论。

采纳的回答

Amit Kansal
Amit Kansal 2021-6-24
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 个评论
Amit Kansal
Amit Kansal 2021-8-2
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

请先登录,再进行评论。

更多回答(2 个)

Muhammad Haris Khan
Muhammad Haris Khan 2019-11-26
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 个评论
Amit Kansal
Amit Kansal 2021-6-9
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.

请先登录,再进行评论。


selva ganesh
selva ganesh 2022-9-13
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]

类别

Help CenterFile Exchange 中查找有关 Error Detection and Correction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by