serhannn
Member level 4
![Member level 4](/styles/images/ranks/dlevel4.gif)
Hi, I'm trying to implement the Berlekamp-Massey algorithm in Matlab to decode Reed-Solomon codes.
As the first, I have to calculate the syndromes obviously to see whether an error has occurred. For this, syndromes are obtained by evaluating the received polynomial at the 2t zeros of the codeword, which means:
S(j)=r(aj)=c(aj)+e(aj)=Σk=0n-1 ek(aj)k j=1,2,...,2t
where t=error correcting capability of the code, n=length of the (n,k) code, a=primitive root of the GF field
When I implement this equation in Matlab, I get the correct result with the following code:
where alpha is the primitive root and codeword is the r in the above equation.
With this code, I get zero-valued syndromes when there is no errors, which means it is correct. But I don't understand why I should write the sum as (n-1:-1:0) rather than (0:1:n-1). If I do the latter, I get a wrong result. Can someone explain why the code should be written like that?
Thanks for your help
As the first, I have to calculate the syndromes obviously to see whether an error has occurred. For this, syndromes are obtained by evaluating the received polynomial at the 2t zeros of the codeword, which means:
S(j)=r(aj)=c(aj)+e(aj)=Σk=0n-1 ek(aj)k j=1,2,...,2t
where t=error correcting capability of the code, n=length of the (n,k) code, a=primitive root of the GF field
When I implement this equation in Matlab, I get the correct result with the following code:
Code:
syndrome=codeword * (alpha.^((n-1:-1:0)'*(1:t2)));
where alpha is the primitive root and codeword is the r in the above equation.
With this code, I get zero-valued syndromes when there is no errors, which means it is correct. But I don't understand why I should write the sum as (n-1:-1:0) rather than (0:1:n-1). If I do the latter, I get a wrong result. Can someone explain why the code should be written like that?
Thanks for your help