Communications Toolbox    
convenc

Convolutionally encode binary data

Syntax

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,init_state) is the same as the syntax above, except that init_state specifies the starting state of the encoder registers. The scalar init_state is an integer between 0 and trellis.numStates-1. If the encoder schematic has more than one input stream, then the shift register that receives the first input stream provides the least significant bits in init_state, while the shift register that receives the last input stream provides the most significant bits in init_state. To use the default value for init_state, specify init_state as 0 or [].

[code,final_state] = convenc(...) encodes the input message and also returns in final_state the encoder's 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 reference page for the poly2trellis function.

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

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.

See Also

vitdec, poly2trellis, istrellis, vitsimdemo

References

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


  compand convmtx