Understanding rsenc (RS encoder) function

6 次查看(过去 30 天)
I was coding an RS encoder (n=7,k=5)
m = 3;
t = 1; % error correcting capacity
%%
n = 2^m-1;
k = n - 2*t;
[gx,~] = rsgenpoly(n,k); % degree is (n-k)
the generator polynomial gx is [1 6 3] which goes well with my understanding that it represents polynomial = x^2 + (alpha)^4 * x + (alpha)^3 .
if the message is x, then its vector form is = [0 0 0 1 0];
encoded polynomial will be gx*x which is to my understanding [0 0 0 1 6 3 0]. i.e x^3 + (alpha)^4 * x^2 + (alpha)^3 * x.
But the following code gives
msg = [0 0 0 1 0]; % degree is k-1
msg_gf = gf(msg,m);
code_gf = rsenc(msg_gf, n, k,gx); % degree is n-1
code_gf = [0 0 0 1 0 1 1].
Why is rsenc giving this vector as output?

回答(1 个)

Zinea
Zinea 2024-9-3
The discrepancy you are observing is due to a misunderstanding of how the Reed-Solomon encoding process works.
The following steps are involved in encoding a message using an RS encoder:
  1. Generator Polynomial: The generator polynomial ( g(x) ) is used to multiply the message polynomial. For your case, the generator polynomial is given as ( g(x) = x^2 + \alpha^4 x + \alpha^3 ).
  2. Message Polynomial: The message polynomial is represented by the vector [0 0 0 1 0], which corresponds to ( x^3 ).
  3. Encoding: The encoding process involves multiplying the message polynomial by ( x^{n-k} ) and then dividing by the generator polynomial ( g(x) ). The remainder of this division is then added to the original message polynomial multiplied by ( x^{n-k} ).
Here is an explanation of the steps in the code:
  1. Message Vector: The original message vector is [0 0 0 1 0], which corresponds to ( x^3 ).
  2. Multiply by (x^{n-k}): Since ( n-k = 2 ), this means shifting the message polynomial by 2 degrees, resulting in ( x^5 ).
  3. Polynomial Division: The shifted message polynomial is divided by the generator polynomial (g(x) ). The remainder of this division is the error correction code.
  4. Encoded Message: The encoded message is the original message polynomial (shifted) plus the error correction code.
The rsenc function performs these operations and returns the encoded codeword, which in your case is [0 0 0 1 0 1 1]. This vector represents the polynomial that includes both the original message and the error correction code. The output [0 0 0 1 0 1 1] indicates that after encoding, the polynomial is (x^3 + \alpha x + \alpha). The last two terms, 1 1, represent the error correction code added to the original message polynomial.
For more information on using 'rsenc', you may refer to the following link:
Hope this clarifies the confusion!

类别

Help CenterFile Exchange 中查找有关 Error Detection and Correction 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by