Documentation |
The BCHEncoder object creates a BCH code with specified message and codeword lengths.
To encode data using a BCH coding scheme:
Define and set up your BCH decoder object. See Construction.
Call step to create a BCH code with message and codeword lengths specified according to the properties of comm.BCHEncoder. The behavior of step is specific to each object in the toolbox.
H = comm.BCHEncoder creates a BCH encoder System object™, H, that performs BCH encoding.
H = comm.BCHEncoder(Name,Value) creates a BCH encoder object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).
CodewordLength |
Codeword length Specify the codeword length of the BCH code as a double-precision, positive, integer scalar. The default is 15. The values of the CodewordLength and MessageLength properties, must produce a valid narrow-sense BCH code. For a full-length BCH code the value of the this property must use the form $${2}^{M}-1$$. In this case, M is an integer, and $$3\le M\le 16$$ corresponds to the degree of the primitive polynomial that you specify with the PrimitivePolynomialSource and PrimitivePolynomial properties. If the this property is less than $${2}^{M}-1$$, the object assumes a shortened code form. |
MessageLength |
Message length Specify the message length as a double-precision, positive, integer scalar. The values of the CodewordLength and MessageLength properties must produce a valid narrow-sense BCH code. The default is 5. |
PrimitivePolynomialSource |
Source of primitive polynomial Specify the source of the primitive polynomial as one of Auto | Property. The default is Auto. When you set this property to Auto, the object uses a primitive polynomial of degree M=ceil(log2(CodewordLength+1)). The result of fliplr(de2bi(primpoly(M))) sets the value for this polynomial. Set this property to Property to specify a polynomial using the PrimitivePolynomial property. |
PrimitivePolynomial |
Primitive polynomial Specify the primitive polynomial of order M, that defines the finite Galois field GF(2). Use a double-precision, binary row vector with the coefficients of the polynomial in order of descending powers. This property applies when you set the PrimitivePolynomialSource property to Property. The default is fliplr(de2bi(primpoly(4))) = [1 0 0 1 1], which corresponds to the polynomial $${x}^{4}+x+1$$. |
GeneratorPolynomialSource |
Source of generator polynomial Specify the source of the generator polynomial as one of Auto | Property. The default is Auto. When you set this property to Auto, the object chooses the generator polynomial automatically. The object computes the generator polynomial based on the value of the PrimitivePolynomialSource property. When you set the PrimitivePolynomialSource property to Auto the object computes the generator polynomial as bchgenpoly(CodewordLength+SL,MessageLength+SL). When you set the PrimitivePolynomialSource property to 'Property', the object computes generator polynomial as bchgenpoly(CodewordLength+SL,MessageLength+SL, PrimitivePolynomial). In both cases, SL = ($${2}^{M}-1$$)-CodewordLength is the shortened length. M indicates the degree of the primitive polynomial that you specify with the PrimitivePolynomialSource and PrimitivePolynomial properties. Set this property to Property to specify a generator polynomial using the GeneratorPolynomial property. |
GeneratorPolynomial |
Generator polynomial Specify the generator polynomial for encoding as a binary, double-precision row vector or as a binary Galois row vector that represents the coefficients of the generator polynomial in order of descending powers. The length of the generator polynomial requires a value of CodewordLength-MessageLength+1. This property applies when you set the GeneratorPolynomialSource property to Property. The default is the result of bchgenpoly(15,5,[],'double'), which corresponds to a (15,5) code. |
CheckGeneratorPolynomial |
Enable generator polynomial checking Set this property to true to perform a generator polynomial check the first time you call the step method. The default is true. This check verifies that $$x$$^{CodewordLength} + 1 is divisible by the generator polynomial specified in the GeneratorPolynomial property. For larger codes, disabling the check reduces processing time. As a best practice, perform the check at least once before setting this property to false. This property applies when you set the GeneratorPolynomialSource property to Property. |
PuncturePatternSource |
Source of puncture pattern Specify the source of the puncture pattern as one of None | Property. The default is None. Set this property to None, to disable puncturing. Set this property to Property to decode punctured codewords. This decoding is based on a puncture pattern vector you specify in the PuncturePattern property. |
PuncturePattern |
Puncture pattern vector Specify the pattern that the object uses to puncture the encoded data. Use a double-precision, binary, column vector of length CodewordLength-MessageLength. Zeros in the puncture pattern vector indicate the position of the parity bits that the object punctures or excludes from each codeword. This property applies when you set the PuncturePatternSource property to Property. The default is [ones(8,1); zeros(2,1)]. |
clone | Create BCH encoder object with same property values |
getNumInputs | Number of expected inputs to step method |
getNumOutputs | Number of outputs from step method |
isLocked | Locked status for input attributes and nontunable properties |
release | Allow property value and input characteristics changes |
step | Encode data using a BCH encoder |
This object implements the algorithm, inputs, and outputs described on the BCH Encoder block reference page. The object properties correspond to the block parameters.