I am trying to understand how Reed Solomon encoding works. Specifically, I am trying to re-generate the example shown in http://www.mathworks.com/help/comm/ref/integerinputrsencoder.html and check if my understanding of Reed Solomon encoding matches with the generated outputs of Matlab.
M = 3. N = 7. K = 5. We operate in GF(8)
input message, U = [2 3 5 2 0]
corresponding output codeword, C = [2 3 5 2 0 1 4].
Matlab used default primitives and generator polymonials to generate this output codeword.
Matlab’s default primitive polynomial for GF(8) is D^3 + D + 1.
Matlab’s default generator polynomial for (N = 7, K = 5) reed Solomon code is: G = [1 6 3].
The associated code to generate C from U is following:
% Code starts
clear all ; close all ; clc ;
M = 3 ;
N = 7 ;
K = 5 ;
U = gf([2 3 5 2 0],M);
G = rsgenpoly(7,5) ;
C = rsenc(U,N,K,G)
% Code finishes
I want to know how Matlab is encoding U using Reed-Solomon encoding. I want to generate an output codeword C’ from U and G myself and check if it matches with C.
Based on my understanding of Reed Solomon coding, the polynomials associated with U and G are following:
Input polynomial, u(x) = 2 * x^4 + 3 * x^3 + 5 * x^2 + 2 * x
Generator polynomial, g(x) = x^2 + 6 * x + 3
If I multiply these two polynomials to get output codeword polynomial c’(x), I get the following:
c’(x) = u(x) * g(x)
= (2 * x^4 + 3 * x^3 + 5 * x^2 + 2 * x ) * (x^2 + 6 * x + 3)
= 2 * x^6 + 15 * x^5 + 29 * x^4 + 41 * x^3 + 27 * x^2 + 6 * x … (Line a)
= 2 * x^6 + 7 * x^5 + 5 * x^4 + x^3 + 3 * x^2 + 6 * x . … (Line b)
Here, Line a and b are equivalent under GF(8).
From line b, C’ = [2 7 5 1 3 6 0] But the entries of C’ do not match that of C, which is the output codeword generated by Matlab.
I want to know what mistake I am making. I want to know how I can get the actual value of C from U and G.
Any suggestion will be very appreciated.