Communications Toolbox    
bchdeco

BCH decoder

Syntax

Description

msg = bchdeco(code,k,t) decodes code using the BCH method. k is the message length. The codeword length n must have the form 2m-1 for some integer m greater than or equal to 3. code is a binary matrix with n columns, each row of which represents one codeword. msg is a binary matrix with k columns, each row of which represents one message. t is the error-correction capability. BCH decoding requires a primitive polynomial for GF(2m); this syntax uses the default primitive polynomial, gfprimdf(m).

msg = bchdeco(code,k,t,prim_poly) is the same as the first syntax, except that prim_poly is a row vector that gives the coefficients, in order of ascending powers, of the primitive polynomial for GF(2m) that will be used during processing.

[msg,err] = bchdeco(...) returns a column vector err that gives information about error correction. A nonnegative integer in err(r) indicates the number of errors corrected in the rth codeword; a negative integer indicates that there are more errors in the rth codeword than can be corrected.

[msg,err,ccode] = bchdeco(...) returns the corrected code in ccode.

Examples

The script below encodes a (random) message, simulates the addition of noise to the code, and then decodes the message.

In this case, all errors are corrected and the message is recovered perfectly. However, if the ninth line is changed to

then some codewords will contain more than t errors. This is too many errors, and some will go uncorrected.

See Also
bchenco, bchpoly


  awgn bchenco