File Exchange

image thumbnail

BCH Decoder and Encoder

version (988 KB) by Miroslav Marinkovic
BCH Encoder and Decoder functions


Updated 13 Jan 2020

View License

BCH Encoder and Decoder functions.
BCH Decoder employs the following steps in decoding :
Syndrome calculation, RiBM algorithm (optimized for BCH codes) and Chien search.

Cite As

Miroslav Marinkovic (2020). BCH Decoder and Encoder (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

hi, Can this function work with Random Linear Network Coding Encoder and Decoder


Code used and benchmarked for shortened and native BCH. Thanks to the author for the update.

This code is great. However, it does not work for the large block sizes in the DVB-S2 specification. For example, it doesn't work with:

n = 16200;
n_max = 65535;
k_max = 65343;
t = 12;
prim_poly = 65581;

The good news is that the problem is easy to fix. Replace all the uint16() functions in the code with uint32(). You will also have to run the following Matlab function once. It took several hours for gftable() to complete on my computer.

gftable(16, 65581);

Hi, can this software be tested for Bit Error Rate simulation of BPSK modulation?


- Testbench script updated to test BCH Encoder/Decoder for different error correction capabilities in a single run
- New testbench script added which estimates BER performance
- MAT file userGftable.mat added (needed for large block size)

- Bug causing incorrect calculaton of error locator polynominal (only when parameter "t" is odd number) has been fixed;
Function "RiBM_BCH_algorithm" affected by this bug is corrected
- All the uint16() functions in the code replaced with uint32()

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux