BCH CODE - with codeword length

8 visualizaciones (últimos 30 días)
Waleed
Waleed el 7 de Dic. de 2013
Comentada: Walter Roberson el 7 de Dic. de 2013
hey guys, i really need help at the following BCH CODE
it did not work with me, im stuck now
here is the instruction:
Before encoding, you need to convert your data u into a Galois field array using the command gf(u,1).
ugf=gf(u,1);
Then encode ugf into a codeword v, using bchenc(); that's the BCH encoder function. You don't need to generate any polynomial.
Add binary noise z to v mod-2 (XOR) to get y. In order to add the noise mod-2, you'll have to convert your binary noise z to a Galois field array using gf(z,1) just as you did u.
The xor and mod operators won't work with v, since v is a Galois field array (necessary for bchenc() and bchdec()).
Decode y using the BCH decoder function bchdec().
The output of bchdec() will be uhat.
f you look at the example in doc bchdec(), be careful not to use the same noise or entire code, because the example is not doing what I'm doing.
here is what i did
clc
clear
n = 63;
k = 30;
u = randi ([0,1],k);
ugf=gf(u,1);
v = bchenc(ugf,n,k);
z = randi ([0,1],k);
zgf = gf(z,1);
for i = 1:1:k
for j = 1:1:k
if v==zgf
y(i,j)=0
else
y(i,j)=1
end
end
end
any help please?
  3 comentarios
Waleed
Waleed el 7 de Dic. de 2013
well, i improved the code. however, the problem is when i want to add binary noise z to v mod-2 (XOR).
it won't give me the right answer it gives me this error Undefined function 'mod' for input arguments of type 'gf'.
Error in final_projecthoward1 (line 16) v=mod(v,2)
here is my code, clc clear n = 63; k = 30;
% u---> ugf---->v
u = randi ([0,1],n,k);
ugf=gf(u,1);
v = bchenc(ugf,n,k);
% z ---> zgf
z = randi ([0,1],k,n);
zgf = gf(z,1);
%the following loops to replace mod-2 for v
for i = 1:k;
for j = 1:n;
if v(i,j)==0;
y(i,j)=0;
else
y(i,j)=1;
end
end
end
%added V-mod2 to zgf
y=y+zgf
%here is U_hat
u_hat=bchdec(y,n,k);
Walter Roberson
Walter Roberson el 7 de Dic. de 2013
y(1:k, 1:n) = 1 - v(1:k, 1:n);
I do not see any "v = mod(v,2)" in your code.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Error Detection and Correction en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by