Main Content

istrellis

True for valid trellis structure

Syntax

[isok,status] = istrellis(s)

Description

[isok,status] = istrellis(s) checks if the input s is a valid trellis structure. If the input is a valid trellis structure, isok is 1 and status is an empty character vector. Otherwise, isok is 0 and status indicates why s is not a valid trellis structure.

A valid trellis structure is a MATLAB structure whose fields are as in the table below.

Fields of a Valid Trellis Structure for a Rate k/n Code 

Field in Trellis StructureDimensionsMeaning
numInputSymbolsScalar Number of input symbols to the encoder: 2k
numOutputSymbolsScalar Number of output symbols from the encoder: 2n
numStatesScalar Number of states in the encoder
nextStatesnumStates-by-2k matrix Next states for all combinations of current state and current input
outputsnumStates-by-2k matrix Outputs (in octal) for all combinations of current state and current input

In the nextStates matrix, each entry is an integer between 0 and numStates-1. The element in the sth row and uth column denotes the next state when the starting state is s-1 and the input bits have decimal representation u-1. To convert the input bits to a decimal value, use the first input bit as the most significant bit (MSB). For example, the second column of the nextStates matrix stores the next states when the current set of input values is {0,...,0,1}.

To convert the state to a decimal value, use this rule: If k exceeds 1, the shift register that receives the first input stream in the encoder provides the least significant bits in the state number, and the shift register that receives the last input stream in the encoder provides the most significant bits in the state number.

In the outputs matrix, the element in the sth row and uth column denotes the encoder's output when the starting state is s-1 and the input bits have decimal representation u-1. To convert to decimal value, use the first output bit as the MSB.

Examples

These commands assemble the fields into a very simple trellis structure, and then verify the validity of the trellis structure.

trellis.numInputSymbols = 2;
trellis.numOutputSymbols = 2;
trellis.numStates = 2;
trellis.nextStates = [0 1;0 1];
trellis.outputs = [0 0;1 1];
[isok,status] = istrellis(trellis)

The output is below.

isok =

     1


status =

     ''

Another example of a trellis is in Trellis Description of a Convolutional Code.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a