Compute distance spectrum of convolutional code
computes the free distance and the requested number of components of the weight and distance
spectra of a linear convolutional code. Because convolutional codes do not have block
boundaries, the weight spectrum and distance spectrum are semi-infinite and well
approximated by the first few components.
spect = distspec(
distspec function to compute the distance spectrum for a rate 2/3 convolutional code. Use the output distance spectrum as an input to the
bercoding function, to find a theoretical upper bound on the bit error rate for a system that uses this code with coherent BPSK modulation. Plot the upper bound using the
The diagram shows a rate 2/3 encoder with two input streams, three output streams, and two shift registers.
Create a trellis structure to represent the encoder. Set the constraint length of the upper path to 5 and the constraint length of the lower path to 4. The octal representation of the code generator matrix corresponds to the taps from the upper and lower shift registers. The trellis structure serves as an input to the
distspec function to represent the rate 2/3 convolutional code.
trellis = poly2trellis([5 4],[23 35 0; 0 5 13])
trellis = struct with fields: numInputSymbols: 4 numOutputSymbols: 8 numStates: 128 nextStates: [128x4 double] outputs: [128x4 double]
spect = distspec(trellis,4)
spect = struct with fields: dfree: 5 weight: [1 6 28 142] event: [1 2 8 25]
bercoding function and the distance spectrum structure to find a theoretical upper bound on the bit error rate for a system that uses this code with coherent BPSK modulation. Plot the upper bound using the
berub = bercoding(1:10,'conv','hard',2/3,spect); % BER upper bound berfit(1:10,berub); ylabel('Upper Bound on BER'); % Plot
trellis— Trellis description
Trellis description, specified as a MATLAB® structure that contains the trellis description for a rate K/N code. K represents the number of input bit streams, and N represents the number of output bit streams.
The trellis structure contains these fields. You can either use the
poly2trellis function to create the trellis structure or create it
manually. For more about this structure, see Trellis Description of a Convolutional Code and the
numInputSymbols— Number of symbols input to encoder
Number of symbols input to the encoder, specified as an integer equal to 2K, where K is the number of input bit streams.
numOutputSymbols— Number of symbols output from encoder
Number of symbols output from the encoder, specified as an integer equal to 2N, where N is the number of output bit streams.
numStates— Number of states in encoder
Number of states in the encoder, specified as a power of 2.
nextStates— Next states
Next states for all combinations of current states and current inputs, specified
as a matrix of integers. The matrix size must be
Outputs for all combinations of current states and current inputs, specified as a matrix of
octal numbers. The matrix size must be
numcomp— Requested number of components
Requested number of components of the weight and distance spectra of a linear convolutional code to compute, specified as a positive integer
spect— Distance spectrum
Distance spectrum, returned as a structure containing these fields:
|Free distance of the code. This is the minimum number of errors in the encoded sequence required to create an error event.|
The function uses a tree search algorithm implemented with a stack, as described in .
 Bocharova, I.E., and B.D. Kudryashov. “Rational Rate Punctured Convolutional Codes for Soft-Decision Viterbi Decoding.” IEEE Transactions on Information Theory 43, no. 4 (July 1997): 1305–13. https://doi.org/10.1109/18.605600.
 Cedervall, M.L., and R. Johannesson. “A Fast Algorithm for Computing Distance Spectrum of Convolutional Codes.” IEEE Transactions on Information Theory 35, no. 6 (November 1989): 1146–59. https://doi.org/10.1109/18.45271.
 Chang J., D. Hwang, and M. Lin. “Some Extended Results on the Search for Good Convolutional Codes.” IEEE Transactions on Information Theory 43, no. 5 (September 1997): 1682–97. https://doi.org/10.1109/18.623175.
 Frenger, P.K., P. Orten, and T. Ottosson. “Comments and Additions to Recent Papers on New Convolutional Codes.” IEEE Transactions on Information Theory 47, no. 3 (March 2001): 1199–1201. https://doi.org/10.1109/18.915683.