www.gusucode.com > 基于matlab编程(31,25)RS编码及解码源码程序 > 基于matlab编程(31,25)RS编码及解码源码程序/code/rs_poly.m

    % a function to compute the value of a polynomial with variable 'x'
% 't' is the vector of the polynomial
% all is done in GF(2^5)
function y=rs_poly(t,x)
T=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18];
xx=find(T==x)-1;
n=length(t)-1;
y1=t(1);
for i=1:n
    y1=rs_add(y1,rs_mul(t(i+1),T(mod(i*xx,31)+1)));
end
y=y1;