Click to Visit Homepage : zzyzz.top


CCS - Channel Capacity and Coding - Channel Coding - Linear Block Codes - Hamming Codes

 

Hamming Codes

 

 

 

Matlab Coding

 

 

 

 

 

 

复制代码
 
 1 % MATLAB script for Illustrative Problem 10.9.
 2 echo on
 3 k=11;
 4 for i=1:2^k
 5     for j=k:-1:1
 6         if rem(i-1,2^(-j+k+1))>=2^(-j+k)
 7             u(i,j)=1;
 8         else
 9             u(i,j)=0;
10         end
11         echo off ;
12     end
13 end
14 echo on ;
15 
16 g=[1 0 0 0 0 0 0 0 0 0 0 1 1 0 0;
17     0 1 0 0 0 0 0 0 0 0 0 0 1 1 0;
18     0 0 1 0 0 0 0 0 0 0 0 0 0 1 1;
19     0 0 0 1 0 0 0 0 0 0 0 1 0 1 0;
20     0 0 0 0 1 0 0 0 0 0 0 1 0 0 1;
21     0 0 0 0 0 1 0 0 0 0 0 0 1 0 1;
22     0 0 0 0 0 0 1 0 0 0 0 1 1 1 0;
23     0 0 0 0 0 0 0 1 0 0 0 0 1 1 1;
24     0 0 0 0 0 0 0 0 1 0 0 1 0 1 1;
25     0 0 0 0 0 0 0 0 0 1 0 1 1 0 1;
26     0 0 0 0 0 0 0 0 0 0 1 1 1 1 1];
27 
28 c=rem(u*g,2);
29 w_min=min(sum((c(2:2^k,:))'));


>> w_min


w_min =


3

复制代码

 

Reference,

  1. <<Contemporary Communication System using MATLAB>> - John G. Proakis

posted @   zzYzz  阅读(177)  评论(0编辑  收藏  举报


Click to Visit Homepage : zzyzz.top


点击右上角即可分享
微信分享提示