% generator matrix
G = [1 0 0 0 0 1 1; 
     0 1 0 0 1 0 1; 
     0 0 1 0 1 1 0; 
     0 0 0 1 1 1 1]

% parity check matrix
H = [0 0 0 1 1 1 1;
     0 1 1 0 0 1 1;
     1 0 1 0 1 0 1]

% message
A = [1 1 0 1]

% coded message
B = A*G

% decoded message
C = mod(B*H',2)

% introducing errors
B(n) = ~B(n);

