Main Content


System object: comm.BCHDecoder
Package: comm

Decode data using a BCH decoder


Y = step(H,X)
[Y,ERR] = step(H,X)
Y = step(H,X,ERASURES)



Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Y = step(H,X) decodes input binary codewords in X using a (CodewordLength,MessageLength) BCH decoder with the corresponding narrow-sense generator polynomial. The step method returns the estimated message in Y. This syntax applies when you set the NumCorrectedErrorsOutputPort property to false. The input and output length of the step function equal the values listed in the table in Input and Output Signal Lengths in BCH and RS System Objects.

[Y,ERR] = step(H,X) returns the number of corrected errors in output ERR when you set the NumCorrectedErrorsOutputPort property to true. A non- negative value in the i-th element of the ERR output vector denotes the number of corrected errors in the i-th input codeword. A value of -1 in the i-th element of the ERR output indicates that a decoding error occurred for the i-th input codeword. A decoding error occurs when an input codeword has more errors than the error correction capability of the BCH code.

Y = step(H,X,ERASURES) uses ERASURES as the erasures pattern input when you set the ErasuresInputPort property to true. The object decodes the binary encoded data input, X, and treats as erasures the bits of the input codewords specified by the binary column vector, ERASURES. The length of ERASURES must equal the length of X, and its elements must be of data type double or logical. Values of 1 in the erasures vector correspond to erased bits in the same position of the (possibly punctured) input codewords.


obj specifies the System object on which to run this step method.

The object performs an initialization the first time the step method is executed. This initialization locks nontunable properties and input specifications. For more information on changing property values, see System Design in MATLAB Using System Objects.