True for valid trellis structure
[isok,status] = istrellis(s)
[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 Structure | Dimensions | Meaning |
---|---|---|
numInputSymbols | Scalar | Number of input symbols to the encoder: 2k |
numOutputSymbols | Scalar | Number of output symbols from the encoder: 2n |
numStates | Scalar | Number of states in the encoder |
nextStates | numStates -by-2k matrix | Next states for all combinations of current state and current input |
outputs | numStates -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.
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.