summaryrefslogtreecommitdiff
path: root/851/CH8/EX8.4/Example8_4.sce
blob: 815e20130ae8d26cfce0aba7454a04f73385b3ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//clear//
//Caption:Encoder for the (7,4) Cyclic Hamming Code
//Example8.4:Encoder for the (7,4) Cyclic hamming code
//message sequence = [1,0,0,1]
//D = poly(0,D);
D = poly(0,'D');
g = 1+D+0+D^3; //generator polynomial
m = (D^3)*(1+0+0+D^3); //message sequence
[r,q] = pdiv(m,g);
p = coeff(r);
disp(r,'remainder in polynomial form')
disp(p,'Parity bits are:')
disp('Table 8.3 Contents of the Shift Register in the Encoder of fig8.7 for Message Sequence(1001)')
disp('__________________________________________________________________________________________')
disp('Shift            Input            Register Contents')
disp('__________________________________________________________________________________________')
disp('1                  1              1 1 0')
disp('2                  0              0 1 1')
disp('3                  0              1 1 1')
disp('4                  1              0 1 1')
disp('____________________________________________________________________________________________')