Decode ReedSolomon code to recover binary vector data
Communications Toolbox / Error Detection and Correction / Block
The BinaryOutput RS Decoder block recovers a binary message vector from a binary ReedSolomon codeword vector. For proper decoding, the parameter values in this block must match parameter values in the corresponding BinaryInput RS Encoder block.
The symbols for the code are binary sequences of length M, corresponding to elements of the Galois field GF(2^{M}). The first bit in each symbol is the most significant bit.
This figure shows the decoder inputoutput word length for codeword length N=7 and message word length K=2. Since N=2^{M}–1, when N=7, the symbol length, M=3.
Each input codeword is a binary vector of length 21 that represents 7 threebit integers. Each corresponding output message word is a binary vector of length 6, that represents 2 threebit integers. For more information, see Input and Output Signal Length in RS Blocks.
This icon shows all ports, including optional ones:
In
— ReedSolomon codewordReedSolomon codeword in bits, specified as an (N_{C}×(N – K + S – P)×M)by1 binary column vector. N_{C} is the number of codewords, N is the Codeword length N (symbols), K is the Message length K (symbols), S is the Shortened message length S (symbols), P is the number of punctures per codeword, and M is the number of bits per symbol.
For more information, see Input and Output Signal Length in RS Blocks.
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
 Boolean
 ufix(1)
Era
— Erasure vectorErasure vector in symbols, specified as an (N_{C}×(N – K + S – P))by1 binary column vector. N_{C} is the number of codewords, N is the Codeword length N (symbols), K is the Message length K (symbols), S is the Shortened message length S (symbols), P is the number of punctures per codeword, and M is the number of bits per symbol.
Erasure values of 1 correspond to erased bits in the same position in the codeword. Values of 0 correspond to bits that are not erased. For more information, see Puncturing and Erasures.
To enable this port, select Enable erasures input port.
Data Types: double
 Boolean
Out
— Decoded messageDecoded message in bits, returned as one of the following:
When there is no message shortening, a (N_{C}×K×M)by1 binary column vector.
When there is message shortening, a (N_{C}×S×M)by1 binary column vector.
N_{C} is the number of message words, K is the Message length K (symbols), M is the number of bits per symbol, and S is the Shortened message length S (symbols).
The number of decoded message words equals the number of codewords.
For more information, see Input and Output Signal Length in RS Blocks.
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
 Boolean
 ufix(1)
Err
— Decoding errorsSymbol decoding errors, returned as an integer vector with N_{C} elements, where N_{C} is the number of codewords. This port indicates the number of symbol errors detected during decoding of each codeword. A negative integer indicates that the block detected more errors than it could correct by using the specified coding scheme.
An (N,K) ReedSolomon code
can correct up to floor((NK)/2)
symbol errors
(not bit errors) in each codeword. When a received codeword contains
more than (NK)/2 symbol
errors, a decoding failure occurs.
To enable this port, select Output number of corrected symbol errors.
Data Types: double
For more information, see Supported Data Types.
Codeword length N (symbols)
— Codeword length7
(default)  integerCodeword length in symbols, specified as an integer.
For more information, see Restrictions on M and Codeword Length N and Input and Output Signal Length in RS Blocks.
Message length K (symbols)
— Message word length3
(default)  integerMessage word length in symbols, specified as an integer in the range [1, N–2], where N is the codeword length.
Shortened message length S (symbols)
— Shortened message word length3
(default)  integerShortened message word length in symbols, specified as an integer, such that S ≤ K. When Shortened message length S (symbols) < Message length K (symbols), the ReedSolomon code is shortened.
You still specify N and K values for the fulllength (N, K) code but the decoding is shortened to an (N–K+S, S) code.
To enable this parameter, select Specify shortened message length.
Generator polynomial
— Generator polynomialrsgenpoly(7, 3, [], [],
'double')
(default)  polynomial character vector  binary row vector  binary Galois row vector Generator polynomial with values from 0 to 2^{M}–1, in order of descending power, specified as one of the following:
A polynomial character vector. For more information, see Character Representation of Polynomials.
An integer row vector that represents the coefficients of the generator polynomial in order of descending power.
An integer Galois row vector that represents the coefficients of the generator polynomial in order of descending power.
Each coefficient is an element of the Galois field defined by the primitive polynomial. For more information, see Specify the Generator Polynomial.
Example: [1 3 1 2 3]
, which is equivalent to
rsgenpoly(7,3)
To enable this parameter, select Specify generator polynomial.
Primitive polynomial
— Primitive polynomial'X^3 + X + 1'
(default)  polynomial character vector  binary row vectorPrimitive polynomial in order of descending power. This polynomial is of order M and defines the finite Galois field GF(2^{M}) corresponding to the integers that form message words and codewords. Specify the primitive polynomial as one of the following:
A polynomial character vector. For more information, see Character Representation of Polynomials.
A binary row vector that represents the coefficients of the generator polynomial.
For more information, see Restrictions on M and Codeword Length N.
Example: 'X^3 + X + 1'
, which is the primitive
polynomial used for a (7,3) code,
de2bi(primpoly(3,'nodisplay'),'leftmsb')
To enable this parameter, select Specify primitive polynomial.
Puncture vector
— Puncture vector[ones(2,1); zeros(2,1)]
(default)  binary column vectorPuncture vector, specified as an
(N–K)by1 binary column vector.
Element indices with 1
s represent data
symbol indices that pass through the block
unaltered. Element indices with 0
s represent data
symbol indices that get punctured, or removed,
from the data stream. For more information, see Puncturing and Erasures.
To enable this parameter, select Punctured code.
Enable erasures input port
— Enable erasures input portSelecting this check box enables the erasures port, Era. For more information, see Puncturing and Erasures.
Output number of corrected symbol errors
— Enable port to output number of corrected symbol errorsSelecting this check box enables an additional output port, Err, which indicates the number of symbol errors the block corrected in the input codeword.
Output data type
— Output type of the blockSame as input
(default)  boolean
 double
Output type of the block, specified as Same as
input
, boolean
, or
double
.
Data Types 

Multidimensional Signals 

VariableSize Signals 

^{[a]} ufix(1) only. 
The ReedSolomon code has a message word length, K, or shortened message word length, S. The codeword length is N – K + S – P, where N is the full codeword length and P is the number of punctures per codeword. When there is no message shortening, the codeword length expression reduces to N – P, because K = S. If the decoder is processing multiple codewords per frame, then the same puncture pattern holds for all codewords.
This table provides expressions for the input and output signal lengths for the ReedSolomon encoder and decoder.
The notation y = N_{C} × x denotes that y is an integer multiple of x.
Input, Erasure, and Output Vector Lengths  

RS Block Coder  No Message Shortening Used  Message Shortening Used 
BinaryInput RS Encoder 
Input Length (bits): N_{C} × K × M Output Length (bits): N_{C} × (N–P) × M 
Input Length (bits): N_{C} × S × M Output Length (bits): N_{C} × (N–K+S–P) × M 
BinaryOutput RS Decoder 
Input Length (bits): N_{C} × (N–P) × M Erasures Length (symbols): N_{C} × (N–P) Output Length (bits): N_{C} × K × M 
Input Length (bits): N_{C} × (N–K+S–P) × M Erasures Length (symbols): N_{C} × (N–K+S–P) Output Length (bits): N_{C} × S × M 
N is the codeword length.
K is the message word length.
S is the shortened message word length.
N_{C} is the number of codewords (and message words).
P is the number of punctures per codeword, and is equal to the number of zeros in the puncture vector.
M is the degree of the primitive polynomial. Each
group of M bits represents an integer between
0
and
2^{M}–1
that belongs to the finite Galois field
GF(2^{M})
.
For more information on representing data for ReedSolomon codes, see Integer Format (ReedSolomon Only).
Also, see Restrictions on M and Codeword Length N.
If you do not select Specify primitive polynomial, valid
values for the codeword length, N, are from 7 to 65535. In this
case, the block uses the default primitive polynomial of degree M =
ceil(log2(N+1))
. You can display the default primitive polynomial by
running primpoly(ceil(log2(N+1)))
.
If you select Specify primitive polynomial, valid values for the primitive polynomial degree, M, are from 3 to 16. The valid values for N in this case are from 7 to 2^{M}–1. Selecting Specify primitive polynomial enables you to specify the primitive polynomial that defines the finite field GF(2^{M}), which corresponds to the values that form message words and codewords.
Select Specify generator polynomial to enable the Generator polynomial parameter for specifying the generator polynomial of the ReedSolomon code. Enter an integer row vector with element values from 0 to 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. For more information about integer and binary format, see Integer Format (ReedSolomon Only). The generator polynomial must be equal to a polynomial with this factored form:
g(x) = (x+α^{b})(x+α^{b+1})(x+α^{b+2})...(x+α^{b+NK1})
α 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 running rsgenpoly
.
If you are using the default primitive polynomial (Specify primitive
polynomial is not selected), the default generator polynomial is
rsgenpoly(N,K)
, where N =
2^{M}1
.
If you are not using the default primitive polynomial (Specify
primitive polynomial is selected) and you specify the primitive
polynomial as poly
, the generator polynomial is
rsgenpoly(N,K,poly)
.
The degree of the generator polynomial is N − K, where N is the codeword length and K is the message word length.
1
s and 0
s have
precisely opposite meanings for the puncture and erasure vectors.
In a puncture vector,
1
means that the data symbol is passed through the block
unaltered.
0
means that the data symbol is to be punctured, or
removed, from the data stream.
In an erasure vector,
1
means that the data symbol is to be replaced with an
erasure symbol.
0
means that the data symbol is passed through the block
unaltered.
These conventions apply to both the encoder and the decoder. For more information, see Shortening, Puncturing, and Erasures.
Port  Supported Data Types 

In 

Out 

Era 

Err 

This block uses the BerlekampMassey decoding algorithm. For information about this algorithm, see Algorithms for BCH and RS Errorsonly Decoding.
[1] Wicker, Stephen B. Error Control Systems for Digital Communication and Storage. Upper Saddle River, NJ: Prentice Hall, 1995.
[2] Berlekamp, Elwyn R. Algebraic Coding Theory. New York: McGrawHill, 1968.
[3] Clark, George C., Jr., and J. Bibb Cain. ErrorCorrection Coding for Digital Communications. New York: Plenum Press, 1981.
아래 MATLAB 명령에 해당하는 링크를 클릭하셨습니다.
이 명령을 MATLAB 명령 창에 입력해 실행하십시오. 웹 브라우저에서는 MATLAB 명령을 지원하지 않습니다.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.