www.pudn.com > matlab.rar > rs_cnv_code2.m, change:2015-04-19,size:565b


%进行RS(255,223),卷积码(2,1,7)的编译码,输入为1到223. 
G=[1 1 1 1 0 0 1;1 0 1 1 0 1 1];  
k = 1; 
msg = 1:223; 
rs_code = rs_encode(msg); 
for i = 1:255 
 r_x(i*8-7:i*8) = de2bi(rs_code(i),8); 
end 
for i = 1:255 
  cnv_code(i*28-27:i*28) = cnv_encd(r_x(i*8-7:i*8)); 
 
right_channel_output(i*28-27:i*28) = cnv_code(i*28-27:i*28); 
code(i*8-7:i*8)=viterbi(G,k,right_channel_output(i*28-27:i*28)); 
 
end 
code; 
for i = 1:255 
r_x(i) = bi2de(code(i*8-7:i*8)); 
end 
m_x=rs_decoder(r_x); 
disp('输入信息序列:') 
pause 
msg 
disp('输出信息序列:') 
pause 
m_x