BCH CODE - with codeword length
6 views (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 7 Dec 2013
y(1:k, 1:n) = 1 - v(1:k, 1:n);
I do not see any "v = mod(v,2)" in your code.
Answers (0)
See Also
Categories
Find more on Error Detection and Correction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!