decoded = rsdec(code,n,k)
decoded = rsdec(code,n,k,genpoly)
decoded = rsdec(...,
[decoded,cnumerr] = rsdec(...)
[decoded,cnumerr,ccode] = rsdec(...)
decoded = rsdec(code,n,k) attempts
to decode the received signal in
code using an
k] Reed-Solomon decoding
process with the narrow-sense generator polynomial.
array of symbols having m bits each. Each
code represents a corrupted systematic codeword,
where the parity symbols are at the end and the leftmost symbol is
the most significant symbol.
n is at most 2m-1.
n is not exactly 2m-1,
code is a corrupted version of a shortened
In the Galois array
decoded, each row represents
the attempt at decoding the corresponding row in
A decoding failure occurs if
(n-k)/2 errors in a row of
In this case,
rsdec forms the corresponding row
decoded by merely removing
from the end of the row of
decoded = rsdec(code,n,k,genpoly) is
the same as the syntax above, except that a nonempty value of
the generator polynomial for the code. In this case,
a Galois row vector that lists the coefficients, in order of descending
powers, of the generator polynomial. The generator polynomial must
n-k. To use the default narrow-sense
generator polynomial, set
decoded = rsdec(..., specifies
whether the parity symbols in
code were appended
or prepended to the message in the coding operation.
The default is
a decoding failure causes
rsdec to remove
from the beginning rather than the end of the row.
[decoded,cnumerr] = rsdec(...) returns
a column vector
cnumerr, each element of which
is the number of corrected errors in the corresponding row of
A value of
a decoding failure in that row in
[decoded,cnumerr,ccode] = rsdec(...) returns
the corrected version of
code. The Galois array
the same format as
code. If a decoding failure
occurs in a certain row of
code, the corresponding
ccode contains that row unchanged.
Set the RS code parameters.
m = 3; % Number of bits per symbol n = 2^m-1; % Codeword length k = 3; % Message length
Generate three codewords composed of 3-bit symbols. Encode the message with a (7,3) RS code.
msg = gf([2 7 3; 4 0 6; 5 1 1],m); code = rsenc(msg,n,k);
Introduce one error on the first codeword, two errors on the second codeword, and three errors on the third codeword.
errors = gf([2 0 0 0 0 0 0; 3 4 0 0 0 0 0; 5 6 7 0 0 0 0],m); noisycode = code + errors;
Decode the corrupted codeword.
[rxcode,cnumerr] = rsdec(noisycode,n,k);
Observe that the number of corrected errors matches the introduced errors for the first two rows. In row three, the number of corrected errors is
-1 because a (7,3) RS code cannot correct more than two errors.
cnumerr = 1 2 -1
k must differ by
an even integer.
n must be between 3 and 65535.
 Wicker, S. B., Error Control Systems for Digital Communication and Storage, Upper Saddle River, NJ, Prentice Hall, 1995.
 Berlekamp, E. R., Algebraic Coding Theory, New York, McGraw-Hill, 1968.