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

    % a function to calculate the syndrome polynomial accoding to the received
% sequence 'r_x'
function synd_x=rs_decode_syndrome(r_x)
% 'G' is the generator polynomial
G=[21 24 16 24 9 10 0];
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];
s=zeros(1,6);
for j=1:6
% use the function rs_poly(t,x) to calculate s(j)=r(a^j)
% all calculations are in the GF(2^5)
   s(j)=rs_poly(r_x,T(j+1));
end
synd_x=[1,s];