Why do I receive an error message when I try to implement a convolutional encoder using poly2trellis([4], [1 1 1])?

12 views (last 30 days)
Why do I receive an error message when I try to implement a convolutional encoder using the following syntax:
poly2trellis([4], [1 1 1])
This gives the following error:
??? Generator describes code of less than specified constraint length.
In fact, the only constraint length that works for code generator [1 1 1] is 1, which does not produce the right Trellis structure.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
In this case, it is helpful to separate the function of the encoder from that of the data source. When the function:
poly2trellis(4, [1 1 1])
is invoked, it describes an encoder that does not, strictly speaking, perform convolutional encoding. It is actually another way to specify a signal delay of 3 samples into the input of the convolutional encoder. In fact, the second output of the encoder is simply the input, delayed by 3 samples.
For POLY2TRELLIS to work properly, the code generator must be specified such that the undelayed input is an input to the adder. For instance,
poly2trellis(4, [10 10])
gives the same error because it defines 3 shift registers but specifies that the output of the first register is sent to the adder. However,
poly2trellis(4, [11 11])
works fine because it specifies that the undelayed input is used in the shift register. (Please note that the generator polynomial is specified in octal format.)
Generally, a code generator [1 1 1] with constraint length of 4 is unconventional in convolutional coding, since the second output bit is a function of only one bit of the input data stream. If this particular encoder configuration is what you want, then you might get it to work by manipulating the input data so as to delay the data stream by 3 samples. Here is a code fragment that does this:
msg = randint(100,1);
% Create a column vector of data
msg1 = reshape(msg,2,50)';
% Create 2 interleaved streams
stream1 = [0; 0; 0; msg1(:,1)];
% Add a delay of 3 to the first stream
stream2 = [msg1(:,2); randint(3,1)];
% Pad the second stream to get proper dimensions
msg2 = [stream1 stream2];
% Concatenate
msg3 = reshape(msg2',106,1);
% Interleave the 2 streams together

More Answers (0)

Community Treasure Hunt

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

Start Hunting!