Code covered by the BSD License  

Highlights from
Convolutional Encoder and Hard Decision Viterbi Decoder

from Convolutional Encoder and Hard Decision Viterbi Decoder by Muhammad Hassan Masood
Convolutional Encoder of Code Rate=1/2, with 3 Memory Elements and a corresponding Hard Decision Vit

[HD]=hamm_dist(A,B)
%Returns the hamming distance b/w two 2 bit codes
function [HD]=hamm_dist(A,B)
HD=0;
for i=1:2
    a=bitget(A, i);
    b=bitget(B, i);
    
    if(a~=b)
        HD=HD+1;
    end
end

Contact us at files@mathworks.com