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

    % a function to simulate the channel
% generate sequence after channel with the selected errors in the selected site
% 't_x' is the sequence input
% 'num' is the number of errors
% 'site' is a vector which elements are the sites of error
% 'value' is a vector which elements are the values of error in the very sites
function r_x=rs_channel(t_x,num,site,value)
r_x=t_x;
% add the very errors to the input sequence in the very sites
if num~=0
   for i=1:num
        r_x(site(i)+1)=rs_add(t_x(site(i)+1),value(i));
    end
end