www.gusucode.com > 基于matlab编程(31,25)RS编码及解码源码程序 > 基于matlab编程(31,25)RS编码及解码源码程序/code/rs_mul.m
% a function to realize multiplication in field GF(2^5) % input 'a','b' are two decimal numbers range from 0 to 31 corresponding to numbers of GF(2^5) % output 'y' is a decimal number range from 0 to 31 corresponding to a number of GF(2^5) function y=rs_mul(a,b) 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]; % for 'a' or 'b' is 0, output 'y' is 0 if a*b==0 y=0; % by check the table, represent the decimal numbers as powers of primitive root % so multiplication turn to addition of the power of primitive root % then check the table again to get the result of multiplication as a % decimal number else a1=find(T==a)-1; b1=find(T==b)-1; c=mod((a1+b1),31); y=T(c+1); end