Documentation 
The BCH Decoder block recovers a binary message vector from a binary BCH codeword vector. For proper decoding, the first two parameter values in this block should match the parameters in the corresponding BCH Encoder block.
This block accepts a column vector input signal with an integer multiple of (N  the number of punctures) elements. Each group of N input elements represents one codeword to be decoded. The values of (N + shortening length) and (K + shortening length) must produce a valid narrowsense BCH code.
If the decoder is processing multiple codewords per frame, then the same puncture pattern holds for all codewords.
For a given codeword length N, only specific message lengths K are valid for a BCH code. For a full length BCH code, N must be of the form 2^{M}1, where $$3\le M\le 16$$. If N is less than 2^{M}1, the block assumes that the code has been shortened by length 2^{M  1}  N. However, if N is greater than or equal to 2^{M1}, Primitive polynomial must be specified to appropriately set the value of M.
No known analytic formula describes the relationship among the codeword length, message length, and errorcorrection capability. For a list of some valid values of K corresponding to values of N up to 511, see the BCH Encoder reference page in the Communications System Toolbox™ documentation.
The primitive and generator polynomials may be specified in their respective fields, which appear after selecting their corresponding check boxes.
To have the block output error information, select Output number of corrected errors. Selecting this option causes a second output port to appear. The second output is the number of errors detected during decoding of the codeword. A negative integer indicates that the block detected more errors than it could correct using the coding scheme.
In the case of a decoder failure, the message portion of the decoder input is returned unchanged as the decoder output.
The sample times of all input and output signals are equal.
For information about the data types each block port supports, see the Supported Data Type table on this page.
This block supports puncturing when you select Punctured code. This selection enables the Puncture vector parameter, which takes in a binary vector to specify the puncturing pattern. For a puncture vector, 1 represents that the data symbol passes unaltered, and 0 represents that the data symbol gets punctured, or removed, from the data stream. This convention applies for both the encoder and the decoder. For more information, see Shortening, Puncturing, and Erasures.
The codeword length.
The message length.
Selecting this check box enables the Primitive polynomial field.
A row vector that represents the binary coefficients of the primitive polynomial in order of descending powers.
This field defaults to de2bi(primpoly(4, 'nodisplay'), 'leftmsb'), corresponding to a (15,5) code.
This parameter appears only when you select Specify primitive polynomial.
Selecting this check box enables the Generator polynomial field.
A row vector that represents the binary coefficients of the generator polynomial in order of descending powers.
The length of the Generator polynomial must be NK+1.
This field defaults to bchgenpoly(15,5).
This parameter appears only when you select Specify generator polynomial.
Each time a model initializes, the block performs a polynomial check. This check verifies that X ^{N} + 1 is divisible by the userdefined generator polynomial, where N represents the full code word length. Selecting this check box disables the polynomial check. For larger codes, disabling the check speeds up the simulation process. You should always run the check at least once before disabling this feature.
This check box appears only when you select Specify generator polynomial.
Selecting this check box enables the field Puncture vector.
This parameter appears only when you select Puncture code.
A column vector of length NK. In the Puncture vector, a value of 1 represents that the data symbol passes unaltered, and 0 represents that the data symbol gets punctured, or removed, from the data stream.
The default value is [ones(8,1); zeros(2,1)].
Selecting this check box will open the Era port.
Through the Era port, you can input a binary column vector the same size as the codeword input.
Erasure values of 1 correspond to erased bits in the same position in the codeword, and values of 0 correspond to bits that are not erased.
Selecting this check box gives the block an additional output port, Err, which indicates the number of errors the block corrected in the input codeword.
Port  Supported Data Types 

In 

Out 

Era 

Err 

[1] Wicker, Stephen B., Error Control Systems for Digital Communication and Storage, Upper Saddle River, N.J., Prentice Hall, 1995.
[2] Berlekamp, Elwyn R., Algebraic Coding Theory, New York, McGrawHill, 1968.
[3] Clark, George C., Jr., and J. Bibb Cain, ErrorCorrection Coding for Digital Communications, New York, Plenum Press, 1981.