extended_hamming_coding.m
来自「matlab编写的turbo码示例程序」· M 代码 · 共 22 行
M
22 行
function code = extended_hamming_coding(msg)
%%%% (31,26)
%% x^5+x^2+1
poly=[1 0 0 1 0 1];
L=length(msg);
divisor = [msg,zeros(1,5)];
for k=1:L
if divisor(k)==1
divisor(k:k+5)=mod(divisor(k:k+5)+poly,2);
end
end
code = [msg,divisor(end-4:end)];
one_num=sum(code);
if mod(one_num,2)==1
code=[code,1];
else
code=[code,0];
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?