Communications Toolbox | ![]() ![]() |
Check if the input is a valid trellis structure
Syntax
Description
[isok,status] = istrellis(s)
checks if the input s
is a valid trellis structure. If the input is a valid trellis structure, then isok
is 1 and status
is an empty string. Otherwise, isok
is 0 and status
is a string that 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.
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, then the shift register that receives the first input stream in the encoder provides the least significant bits in the state number, while 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) isok = 1 status = ''
Another example of a trellis is in Trellis Description of a Convolutional Encoder.
See Also
poly2trellis
, struct
, convenc
, vitdec
![]() | isprimitive | lloyds | ![]() |