📄 rs_decoder.asv
字号:
% a function to realize a decoder, summation of some of the other functions
% the input 'r_x' is the output sequence of the function rs_channel()
% the output 'm_x' is the sequence after decoding
function m_x=rs_decoder(r_x);
disp('伴随多项式:')
synd_x=rs_decode_syndrome(r_x);
% to view the results clearly, pause, press any key to continue
disp('Press any key to continue...')
pause
disp('错误位置多项式:')
sigma_x=rs_decode_iterate(synd_x);
disp('Press any key to continue...')
pause
disp('错误位置多项式的根:')
root=rs_decode_root(sigma_x);
disp('Press any key to continue...')
pause
% if number of error is more than t, cases of no root and few or more root will occur
if length(root)==0
disp('检测不到错误发生,解码输出:')
m_x=r_x(7:31);
else
disp('错误数值和错误位置:')
[value,site]=rs_decode_forney(synd_x,sigma_x,root);
disp('Press any key to continue...')
pause
temp=r_x;
for i=1:length(site)
temp(site(i)+1)=rs_add(r_x(site(i)+1),value(i));
end
if length(root)>3
disp('Too many errors occur, can not correct them all')
disp('部分纠错解码输出:')
m_x=temp(7:31);
else
disp('解码输出:')
m_x=temp(7:31);
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -