Encodes the message msg using a [n,k] Reed-Solomon coding. The variable msg is a Galois array with k columns and an arbitrary number of rows. Each row of msg represents a single block to be coded by the Reed-Solomon coder. The coded message is returned in the Galois array code containing n columns and the same number of rows as msg.
The use of rsenc
can be seen in the following short example.
m = 3; n = 2^m -1; k = 3; msg = gf ([1 2 3; 4 5 6], m); code = rsenc (msg, n, k);
If n does not equal 2^m-1
, where m is an integer, then a
shorten Reed-Solomon coding is used where zeros are added to the start of
each row to obtain an allowable codeword length. The returned code
has these prepending zeros stripped.
By default the generator polynomial used in the Reed-Solomon coding is based
on the properties of the Galois Field in which msg is given. This
default generator polynomial can be overridden by a polynomial in g.
Suitable generator polynomials can be constructed with rsgenpoly
.
fcr is an integer value, and it is taken to be the first consecutive
root of the generator polynomial. The variable prim is then the
primitive element used to construct the generator polynomial, such that
g = (x - A^b) * (x - A^(b+prim)) * ... * (x - A^(b+2*t*prim-1)).
where b is equal to fcr * prim
. By default fcr
and prim are both 1.
By default the parity symbols are placed at the end of the coded message.
The variable parpos controls this positioning and can take the values
"beginning"
or "end"
.
See also: gf, rsdec, rsgenpoly.
Package: communications