| Communications Toolbox™ | ![]() |
h = fec.bchenc
h = fec.bchenc(N,K)
h = fec.bchenc(property1, value1, ...)
h = fec.bchenc(bchdec_object)
enc = fec.bchenc constructs a BCH encoder enc with default properties. It is equivalent to: enc = fec.bchenc(7,4)
enc = fec.bchenc(N,K) constructs an (N,K) BCH encoder object enc.
enc = fec.bchenc(property1, valule1, ...) constructs a BCH encoder object enc with properties as specified by PROPERTY/VALUE pairs.
enc = fec.bchenc(bchdec_object) constructs a BCH encoder object enc by reading the property values from the BCH decoder object bchdec_object
A BCH encoder object has the following properties, which are all writable except for the ones explicitly noted otherwise.
| Property | Description |
|---|---|
| Type | The type of encoder object. This property also displays the effective message length and codeword length, taking shortening and puncturing into consideration. This property is not writable. |
| N | The codeword length of the base code, not including shortening or puncturing. |
| K | The uncoded message length, not including shortening. |
| T | The number of errors the base code is capable of correcting. This property is not writable. |
| ShortenedLength | The number of bits by which the code has been shortened. |
| ParityPosition | Must be 'beginning' or 'end'. Specifies if parity bits should appear at the beginning or end of the codeword. |
| PuncturePattern | Indicates which parity bits in a codeword are punctured. This binary-valued vector is of length N-K. Values of "0" indicate bits that are punctured, and values of "1" indicate bits that are not. |
| GenPoly | The generator polynomial for the code. GenPoly must be a Galois row vector that lists the coefficients, in order of descending powers, of the generator polynomial. |
Encodes MSG using the BCH code specified by a BCH encoder object ENC. MSG must be an array of binary elements, with an integer multiple of K-ShortenedLength elements per column. There may be multiple codewords per channel, where each group of K-ShortenedLength input elements represents one message word to be encoded. Each column of MSG is considered to be a separate channel, with the same BCH code applied to each channel.
%Create BCH encoder object.
enc = fec.bchenc(7,4);
% Create a message to be encoded.
msg = [0 1 1 0]';
% Encode msg with the ENCODE function.
code = encode(enc,msg);
% Create a shortened encoder
encShort = copy(enc);
encShort.ShortenedLength = 1;
% Create a shortened message
msgShort = [0 1 1]';
codeShort = encode(encShort,msgShort);
% Create a punctured encoder
encPunc = copy(enc);
encPunc.PuncturePattern = [1 0 1];
% Create a punctured message
codePunc = encode(encPunc,msg);
[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, McGraw-Hill, 1968.
![]() | fec.bchdec | fec.rsdec | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |