>> help vitdec
VITDEC Convolutionally decode binary data using the Viterbi algorithm.
DECODED = VITDEC(CODE,TRELLIS,TBLEN,OPMODE,DECTYPE) decodes the vector CODE
using the Viterbi algorithm. CODE is assumed to be the output of a
convolutional encoder specified by the MATLAB structure TRELLIS. See
POLY2TRELLIS for a valid TRELLIS structure. Each symbol in CODE consists
of log2(TRELLIS.numOutputSymbols) bits, and CODE may contain one or more
symbols. DECODED is a vector in the same orientation as CODE, and each of
its symbols consists of log2(TRELLIS.numInputSymbols) bits. TBLEN is a
positive integer scalar that specifies the traceback depth.
OPMODE denotes the operation mode of the decoder. Choices are:
'trunc' : The encoder is assumed to have started at the all-zeros state.
The decoder traces back from the state with the best metric.
'term' : The encoder is assumed to have both started and ended at the
all-zeros state. The decoder traces back from the all-zeros
state.
'cont' : The encoder is assumed to have started at the all-zeros state.
The decoder traces back from the state with the best metric. A
delay equal to TBLEN symbols is incurred.
DECTYPE denotes how the bits are represented in CODE. Choices are:
'unquant' : The decoder expects signed real input values. +1 represents
a logical zero and -1 represents a logical one.
'hard' : The decoder expects binary input values.
'soft' : See the syntax below.
DECODED = VITDEC(CODE,TRELLIS,TBLEN,OPMODE,'soft',NSDEC) decodes the input
vector CODE consisting of integers between 0 and 2^NSDEC-1, where
0 represents the most confident 0 and 2^NSDEC-1 represents the most
confident 1.
Note that NSDEC is a required argument if and only if the decision type is
'soft'.
DECODED = VITDEC(CODE, TRELLIS, TBLEN, OPMODE, DECTYPE, PUNCPAT)
decodes the input punctured CODE where PUNCPAT is the puncture pattern
vector of 1's and 0's with 0's indicating where the punctures occurred
in the data stream.
DECODED = VITDEC(CODE, TRELLIS, TBLEN, OPMODE, DECTYPE, PUNCPAT, ERASPAT)
allows an erasure pattern (ERASPAT) vector to be specified for the input
CODE where the 1's indicate the corresponding erasures. ERASPAT and CODE
must be of the same length. If puncturing is not used, specify PUNCPAT
to be [].
DECODED = VITDEC(..., 'cont', ..., INIT_METRIC,INIT_STATES,INIT_INPUTS)
provides the decoder with initial state metrics, initial traceback states
and initial traceback inputs. Each real number in INIT_METRIC represents
the starting state metric of the corresponding state. INIT_STATES and
INIT_INPUTS jointly specify the initial traceback memory of the decoder.
They are both TRELLIS.numStates-by-TBLEN matrices. INIT_STATES consists of
integers between 0 and TRELLIS.numStates-1. INIT_INPUTS consists of
integers between 0 and TRELLIS.numInputSymbols-1. To use default values for
all of the last three arguments, specify them as [],[],[].
[DECODED FINAL_METRIC FINAL_STATES FINAL_INPUTS] = VITDEC(..., 'cont', ...)
returns the state metrics, traceback states and traceback inputs at the end
of the decoding process. FINAL_METRIC is a vector with TRELLIS.numStates
elements which correspond to the final state metrics. FINAL_STATES and
FINAL_INPUTS are TRELLIS.numStates-by-TBLEN matrices.
Example:
t = poly2trellis([3 3],[4 5 7;7 4 2]); k = log2(t.numInputSymbols);
msg = [1 1 0 1 1 1 1 0 1 0 1 1 0 1 1 1];
code = convenc(msg,t); tblen = 3;
[d1 m1 p1 in1]=vitdec(code(1:end/2),t,tblen,'cont','hard')
[d2 m2 p2 in2]=vitdec(code(end/2+1:end),t,tblen,'cont','hard',m1,p1,in1)
[d m p in] = vitdec(code,t,tblen,'cont','hard')
% The same decoded message is returned in d and [d1 d2]. The pairs m and
% m2, p and p2, in and in2 are equal. Note that d is a delayed version of
% msg, so d(tblen*k+1:end) is the same as msg(1:end-tblen*k).
See also convenc, poly2trellis, istrellis.
Reference page in Help browser
doc vitdec
>> t = poly2trellis([3 3],[4 5 7;7 4 2]); k = log2(t.numInputSymbols);
msg = [1 1 0 1 1 1 1 0 1 0 1 1 0 1 1 1];
code = convenc(msg,t); tblen = 3;
[d1 m1 p1 in1]=vitdec(code(1:end/2),t,tblen,'cont','hard')
[d2 m2 p2 in2]=vitdec(code(end/2+1:end),t,tblen,'cont','hard',m1,p1,in1)
[d m p in] = vitdec(code,t,tblen,'cont','hard')
d1 =
0 0 0 0 0 0 1 1
m1 =
Columns 1 through 13
3 3 2 3 4 2 3 0 3 3 2 3 2
Columns 14 through 16
1 3 2
p1 =
0 5 4
2 7 6
0 0 4
2 7 3
8 13 8
10 15 11
8 13 12
10 10 14
0 5 4
2 6 2
0 0 4
2 7 3
8 8 12
10 10 14
8 13 9
10 15 14
in1 =
0 0 0
0 0 0
2 2 2
2 2 2
0 0 0
0 0 0
2 2 2
2 2 2
1 1 1
1 1 1
3 3 3
3 3 3
1 1 1
1 1 1
3 3 3
3 3 3
d2 =
0 1 1 1 1 0 1 0
m2 =
Columns 1 through 13
2 3 2 2 1 2 2 2 3 2 3 2 2
Columns 14 through 16
3 0 3
p2 =
1 1 1
3 2 7
4 1 4
3 3 7
9 12 13
11 11 15
9 9 13
10 11 10
4 1 4
6 6 6
1 0 0
3 2 7
8 9 8
11 11 10
9 12 13
14 14 15
in2 =
0 0 0
0 0 0
2 2 2
2 2 2
0 0 0
0 0 0
2 2 2
2 2 2
1 1 1
1 1 1
3 3 3
3 3 3
1 1 1
1 1 1
3 3 3
3 3 3
d =
Columns 1 through 13
0 0 0 0 0 0 1 1 0 1 1 1 1
Columns 14 through 16
0 1 0
m =
Columns 1 through 13
2 3 2 2 1 2 2 2 3 2 3 2 2
Columns 14 through 16
3 0 3
p =
1 1 1
3 2 7
4 1 4
3 3 7
9 12 13
11 11 15
9 9 13
10 11 10
4 1 4
6 6 6
1 0 0
3 2 7
8 9 8
11 11 10
9 12 13
14 14 15
in =
0 0 0
0 0 0
2 2 2
2 2 2
0 0 0
0 0 0
2 2 2
2 2 2
1 1 1
1 1 1
3 3 3
3 3 3
1 1 1
1 1 1
3 3 3
3 3 3