



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




We can define row vectors using transpose:
v1 :=[ 1 0 1 0 1 0 1 ]
v2 :=[ 0 1 1 1 0 0 0 ]
Or, we can define the vectors as matrices:
> v3:=matrix(1,7,[1,0,1,0,1,0,1]);
v4:=matrix(1,7,[1,1,1,1,1,0,1]);
Generator Matrix for the Hamming‐(7,4) code:
1 1 1 0 0 0 0
1 0 0 1 1 0 0
0 1 0 1 0 1 0
1 1 0 1 0 0 1
H
G
⎡ ⎤
⎢ ⎥
⎢ ⎥
⎢ ⎥
⎣ ⎦
v [ 1 1 0 1 1 0 1 ]
v3 :=[ 1 0 1 0 1 0 1 ]
v4 :=[ 1 1 1 1 1 0 1 ]
v :=[ 0 1 0 1 0 0 0 ]
Now ‐ suppose we want to add an 8th parity check digit:
a :=[ 0 1 1 0 ]
b :=[ 1 1 0 0 1 1 0 ]
cw :=[ 1 1 0 0 1 1 0 0 ]
Error-Correcting with the Hamming-(8,4) Code
> restart:
> with(linalg): with(LinearAlgebra):
P:=transpose(<<0,0,1>|<0,1,0>|<0,1,1>|<1,0,0>|<1,0,1>|<1,1,0>|<
> rv:=matrix(1,8,[1,0,1,0,1,0,0,0]);
> parity:=map(modp,sum(rv[1,j],j=1..8),2);
> chckword:=map(modp,multiply(delcols(rv,8..8),P),2);
> if parity = 1 then #one error in word or 8th digit
> if chckword[1,1]+chckword[1,2]+chckword[1,3] > 0 then
digiterror:=chckword[1,3]+2chckword[1,2]+4chckword[1,1];**
> rv[1,digiterror]:=(rv[1,digiterror]+1)mod 2;
> print("Single Error Corrected in position",
digiterror);
> u[1]:=rv[1,3]:u[2]:=rv[1,5]:u[3]:=rv[1,6]:u[4]:=rv[1,7]:
> print(u[t] $t=1..4);
> else
> print("Error in Check Digit Only");
u[1]:=rv[1,3]:u[2]:=rv[1,5]:u[3]:=rv[1,6]:u[4]:=rv[1,7]:
> print(u[t] $t=1..4);
> end if
rv :=[ 1 0 1 0 1 0 0 0 ]
parity := 1
chckword := [ 1 1 1 ]
> elif chckword[1,1]+chckword[1,2]+chckword[1,3] = 0 then
> print("No error");
u[1]:=rv[1,3]:u[2]:=rv[1,5]:u[3]:=rv[1,6]:u[4]:=rv[1,7]:
> print(u[t] $t=1..4);
> else print("Double Error Detected")
> end if:
"Single Error Corrected in position" , 7
a) 1011 0110 101 b) 1101 1011 011 c) 0000 1111 000
check digit.)
b) What are the parity checks for this code?
c) What are the check positions for words in this code?
d) How many codewords are there in this code?
e) What is the size (dimension) of the generator matrix G for this code?
f) Find the generator matrix for this code. (Use graph paper or Excel to write it – it’s not
necessary to use Maple.)
then determine the correct 4 information digits in each word. Indicate the position of any errors
(if there are any). If there are double‐errors indicate that you cannot correctly decode.
a) r 1 = [00001000] b) r 2 = [01011011]
c) r 3 = [01111001] d) r 4 = [01100110]
e) r 5 = [10010000] f) r 6 =01010111]
g) r 7 = [01111111]
then report the correct 11 information digits in each word. Indicate the position of any errors (if
there are any). If there are double‐errors indicate that you cannot correctly decode.
a) r 1 = [0011 0111 0001 1110]
b) r 2 = [0111 1111 1000 0001]
c) r 3 = [1011 0100 1010 1010]
d) r 4 = [1100 1000 1001 0000]
e) r 5 =^ [0111^0010 1111 1111]