0

I don't know if this fits here but here goes:

I have some noisy data encoded using a Hamming Block Code and I'd like to decode them using a Viterbi Decoder.

I made my homework thus I know how the Viterbi Block Decoder works but I'd like to avoid implementing it all by myself as it would take quite some time and might be suboptimal.

My question is the following: do you know of any matlab function for Viterbi Block Decoder? I found comm.ViterbiDecoder but it is only for convolutional encoding.

In the mean time I tried to retrieve as many information as I could from the encoder in case it might be needed in the future (see code below).

% Parameters
codewordLength = 31;
messageLength = 26;
data = randi([0, 1], 1, messageLength);

% Encoder 1
encoder1 = comm.BCHEncoder(...
    'CodewordLength', codewordLength, ...
    'MessageLength', messageLength);

% Encoder 2
M = ceil(log2(codewordLength+1));
primitivePolynomialDe = primpoly(M, 'nodisplay');
primitivePolynomialBi = fliplr(de2bi(primitivePolynomialDe));
SL = (2^M-1) - codewordLength;
generatorPolynomial = bchgenpoly(codewordLength + SL, ...
    messageLength + SL, primitivePolynomialDe);
encoder2 = comm.BCHEncoder(...
    'CodewordLength', codewordLength, ...
    'MessageLength', messageLength, ...
    'PrimitivePolynomialSource', 'Property', ...
    'PrimitivePolynomial', primitivePolynomialBi, ...
    'GeneratorPolynomialSource', 'Property', ...
    'GeneratorPolynomial', generatorPolynomial);



dataEncoded1 = step(encoder1, data.').';
dataEncoded2 = step(encoder2, data.').';

sum(dataEncoded1~=dataEncoded2)
Leo
  • 1,129
  • 4
  • 23
  • 38
  • Can you really decode a Hamming code with a Viterbi decoder? I never heard of that. Can you post a link to the "Viterbi block decoder"? – Luis Mendo Aug 09 '13 at 09:53
  • @LuisMendo I don't have a link but the basic idea is to transform the soft bit string to a hard bit string using the viterbi algorithm with a 0 ending and 0 starting and then decode it using the regular technique. – Leo Aug 09 '13 at 11:03
  • Yes, but how do you define the code trellis? The Viterbi algorithm needs to know which transitions it should expect on the trellis. That is, you would have to express the block code in terms of an equivalent convolutional code with a certain constraint length. Are you sure that can be done? Unless the original block code has certain properties, I think the constraint length of the equivalent convolutional code will be very large, and the complexity of the Viterbi decoder will be large as well. – Luis Mendo Aug 09 '13 at 11:11
  • @LuisMendo I can't find an online resource but here is the formula I have for the trellis. If `H` is the parity check matrix in the form `[P.'|I]`, `H(t)` the colunum of `H` number `t`, `S(t)` the state and `b(t)` the bit then: `S(t) = S(t-1) XOR b(t)*H(t)`. – Leo Aug 09 '13 at 11:18

0 Answers0