Products & Services Solutions Academia Support User Community Company

Learn more about Communications Toolbox   

convenc - Convolutionally encode binary data

Syntax

code = convenc(msg,trellis)
code = convenc(msg,trellis,puncpat)
code = convenc(msg,trellis,...,init_state)
[code,final_state] = convenc(...)

Description

code = convenc(msg,trellis) encodes the binary vector msg using the convolutional encoder whose MATLAB trellis structure is trellis. For details about MATLAB trellis structures, see Trellis Description of a Convolutional Encoder. Each symbol in msg consists of log2(trellis.numInputSymbols) bits. The vector msg contains one or more symbols. The output vector code contains one or more symbols, each of which consists of log2(trellis.numOutputSymbols) bits.

code = convenc(msg,trellis,puncpat) is the same as the syntax above, except that it specifies a puncture pattern, puncpat, to allow higher rate encoding. puncpat must be a vector of 1s and 0s, where the 0s indicate the punctured bits. puncpat must have a length of at least log2(trellis.numOutputSymbols) bits.

code = convenc(msg,trellis,...,init_state) allows the encoder registers to start at a state specified by init_state. init_state is an integer between 0 and trellis.numStates-1 and must be the last input parameter.

[code,final_state] = convenc(...) encodes the input message and also returns the encoder's state in final_state. final_state has the same format as init_state.

Examples

The command below encodes five two-bit symbols using a rate 2/3 convolutional code. A schematic of this encoder is on the poly2trellis reference page.

code1 = convenc(randint(10,1,2,123),...
poly2trellis([5 4],[23 35 0; 0 5 13]));

The commands below define the encoder's trellis structure explicitly and then use convenc to encode 10 one-bit symbols. A schematic of this encoder is in Trellis Description of a Convolutional Encoder.

trel = struct('numInputSymbols',2,'numOutputSymbols',4,...
'numStates',4,'nextStates',[0 2;0 2;1 3;1 3],...
'outputs',[0 3;1 2;3 0;2 1]);
code2 = convenc(randint(10,1),trel);

The commands below illustrate how to use the final state and initial state arguments when invoking convenc repeatedly. Notice that [code3; code4] is the same as the earlier example's output, code1.

trel = poly2trellis([5 4],[23 35 0; 0 5 13]);
msg = randint(10,1,2,123);
% Encode part of msg, recording final state for later use.
[code3,fstate] = convenc(msg(1:6),trel);
% Encode the rest of msg, using state as an input argument.
code4 = convenc(msg(7:10),trel,fstate);

Examples

For some commonly used puncture patterns for specific rates and polynomials, see the last three references.

See Also

distspec, vitdec, poly2trellis, istrellis, vitsimdemo, Convolutional Coding

References

[1] Clark, G. C. Jr. and J. Bibb Cain., Error-Correction Coding for Digital Communications, New York, Plenum Press, 1981.

[2] Gitlin, Richard D., Jeremiah F. Hayes, and Stephen B. Weinstein, Data Communications Principles, New York, Plenum, 1992.

[3] Yasuda, Y., et. al., "High rate punctured convolutional codes for soft decision Viterbi decoding," IEEE Transactions on Communications, vol. COM-32, No. 3, pp 315–319, Mar. 1984.

[4] Haccoun, D., and G. Begin, "High-rate punctured convolutional codes for Viterbi and sequential decoding," IEEE Transactions on Communications, vol. 37, No. 11, pp 1113–1125, Nov. 1989.

[5] Begin, G., et.al., "Further results on high-rate punctured convolutional codes for Viterbi and sequential decoding," IEEE Transactions on Communications, vol. 38, No. 11, pp 1922–1928, Nov. 1990.

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS