Convolutional Coding/Decoding Using Matlab Functions

70 ビュー (過去 30 日間)
Jared
Jared 2012 年 12 月 3 日
回答済み: selva ganesh 2022 年 9 月 13 日
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 件のコメント
anees rafeh
anees rafeh 2021 年 8 月 2 日
i am using matlab R2019a
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 Center および File ExchangeError Detection and Correction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by