Create ReedSolomon code from integer vector data
Block sublibrary of Error Detection and Correction
The IntegerInput RS Encoder block creates a ReedSolomon code with message length K and codeword length N – number of punctures. You specify N and K directly in the block dialog. The symbols for the code are integers between 0 and 2^{M}1, which represent elements of the finite field GF(2^{M}). Restrictions on M and N are described in Restrictions on M and the Codeword Length N below.
The block can output shortened codewords when you specify the Shortened message length, S. In this case, specify codeword length N and message length K as the fulllength (N, K) code that is shortened to an (N–K+S, S) code.
The input and output are integervalued signals that represent messages and codewords, respectively. The input and output signal lengths are listed in the Input and Output Signal Length in BCH and RS Blocks table on the BCH Decoder reference page. For information about the data types each block port supports, see the Supported Data Types table.
For more information on representing data for ReedSolomon codes, see Integer Format (ReedSolomon Only).
If the encoder is processing multiple codewords per frame, then the same puncture pattern holds for all codewords.
The default value of M is the smallest integer
that is greater than or equal to log2(N+1), that
is, ceil(log2(N+1))
. You can change the value of M from
the default by specifying the primitive polynomial for GF(2^{M}),
as described in Specify the Primitive Polynomial below.
An (N, K) ReedSolomon
code can correct up to floor((NK)/2)
symbol errors
(not bit errors) in each codeword.
You can specify the primitive polynomial that defines the finite
field GF(2^{M}),
corresponding to the integers that form messages and codewords. To
do so, first select Specify primitive polynomial.
Then, in the Primitive polynomial text box, enter
a binary row vector that represents a primitive polynomial over GF(2)
of degree M, in descending order of powers. For
example, to specify the polynomial x^{3}+x+1,
enter the vector [1 0 1 1]
.
If you do not select Specify primitive polynomial,
the block uses the default primitive polynomial of degree M = ceil(log2(N+1)).
You can display the default polynomial by entering primpoly(ceil(log2(N+1)))
at
the MATLAB^{®} prompt.
If you do not select Specify primitive polynomial, codeword length N must lie in the range 7 < N ≤ 2^{16}–1.
If you do select Specify primitive polynomial, N must lie in the range 7 ≤ N ≤ 2^{M}–1 and the degree M of the primitive polynomial must lie in the range 3 ≤ M ≤ 16.
You can specify the generator polynomial for the ReedSolomon code. To do so, first select Specify generator polynomial. Then, in the Generator polynomial text box, enter an integer row vector whose entries are between 0 and 2^{M}1. The vector represents a polynomial, in descending order of powers, whose coefficients are elements of GF(2^{M}) represented in integer format. See the section Integer Format (ReedSolomon Only) for more information about integer format. The generator polynomial must be equal to a polynomial with a factored form
g(x) = (x+A^{b})(x+A^{b+1})(x+A^{b+2})...(x+A^{b+NK1}),
where A is the primitive element of the Galois field over which the input message is defined, and b is an integer.
If you do not select Specify generator polynomial,
the block uses the default generator polynomial, corresponding to b=1,
for ReedSolomon encoding. You can display the default generator polynomial
by entering rsgenpoly(N1,K1)
, where N1
= 2^M1
and K1 = K+(N1N)
, at the MATLAB prompt,
if you are using the default primitive polynomial. If the Specify
primitive polynomial box is selected, and you specify the
primitive polynomial specified as poly
, the default
generator polynomial is rsgenpoly(N1,K1,poly)
.
Note: The degree of the generator polynomial, M, must be equal to the codeword length, N, minus the message length, K, that is, M = N − K. 
The block supports puncturing when you select the Puncture
code check box. This selection enables the Puncture
vector parameter, which takes in a binary vector to specify
the puncturing pattern. For a puncture vector, 1
represents
that the data symbol passes unaltered, and 0
represents
that the data symbol gets punctured, or removed, from the data stream.
This convention is carried for both the encoder and the decoder.
For more information, see Shortening, Puncturing, and Erasures.
Suppose M = 3, N = 2^{3}1 = 7, and
K = 5. Then a message is a vector of length 5 whose entries are integers
between 0 and 7. A corresponding codeword is a vector of length 7
whose entries are integers between 0 and 7. The following figure illustrates
possible input and output signals to this block when Codeword
length N is set to 7
, Message
length K is set to 5
, and the default
primitive and generator polynomials are used.
The codeword length.
The message length.
Selecting this check box enables the Shortened message length text box.
The shortened message length. When you specify this property, provide fulllength N and K values to specify the (N, K) code that is shortened to an (N–K+S, S) code.
Selecting this check box enables the Generator polynomial parameter.
This text box is available only when Specify generator polynomial is selected.
Integer row vector, whose entries are in the range from 0 to 2^{M}1, representing the generator polynomial in descending order of powers. Each coefficient is an element of the Galois field defined by the primitive polynomial.
Selecting this check box enables the Primitive polynomial text box.
Binary row vector representing the primitive polynomial in descending order of powers.
This parameter applies when only when you select Specify primitive polynomial.
Selecting this check box enables the Puncture vector text box.
This field is available only when Puncture code is selected.
A column vector of length NK.
In a puncture vector, 1
represents that the data
symbol passes unaltered, and 0
represents that
the data symbol gets punctured, or removed, from the data stream.
The default value is [ones(2,1); zeros(2,1)]
.
This parameter applies only when you select Puncture code.
Port  Supported Data Types 

In 

Out 

This object implements the algorithm, inputs, and outputs described in Algorithms for BCH and RS Errorsonly Decoding.
BinaryInput RS Encoder  comm.RSEncoder
 rsenc
 rsgenpoly
 primpoly