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

    % a function to realize addition 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_add(a,b)   
a1=de2bi(a,5);
b1=de2bi(b,5);
y1=a1+b1;
y2=mod(y1,2);
y=bi2de(y2);