필터 지우기
필터 지우기

Convolutional Coding/Decoding Using Matlab Functions

조회 수: 29 (최근 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 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