汉明码编码译码

标签:
汉明码hammingcode杂谈 |
分类: 通信原理MATLAB仿真 |
The execution of this MATLAB program will generate the following results, which include the
erroneous codeword, the syndrome, the error pattern, and the corrected codeword.
http://s11/middle/59a069d5nc515146da74a&690
% Chapter 15 Error Correcting Codes
%
% In our next exercise, we provide a program to decode
the(7,4)
% Hamming code of Example 15.3.
%
% Matlab Program < Ex15_3.m >
% to illustrate encoding and decoding of Hamming (7,4) code
%
G=[1 0 0 0 1 0
1
H=[G(:,5:7)',
eye(3,3)];
E=[1 0 0 0 0 0
0
K=size(E,1);
Syndrome=mod(mtimes(E,H'),2);
r=[1 0 1 0 1 1
1]
display(['Syndrome ','Error Pattern'])
display(num2str([Syndrome E]))
x=mod(r*H',2);
for kk=1:K,
end
syndrome=Syndrome(idxe,:)
error=E(idxe,:)
cword=xor(r,error)
%------------------------------------------------------------
% 参考文献
% B.P.拉兹,丁峙. 现代数字与模拟通信系统[M]. 第4版.
北京:电子工业出版社,2011:967-968