Hi
I wrote this program to see if by making a few errors in the received codeword filipping the coding bits in the code word decoder ldpc I'm correct or not, but ...
Decoding did not respond favorably to
Where do you think the problem??[function []=test_decoser_bity(H,v,iter,numeror)
fals=randi(length(v),1,numeror);
v(fals)= ~v(fals);
z=[];
[sBitFilip,vHat_BitFilip] = decodeBitFlip(v,H,iter);
[synWbf,v_hatWbf] = ldpc_wbf(H,v,iter);
[sBF ,vBF]=LDPC_BF_decode(H,v,iter) ;
[skhodam , v_hatkhodam]= decoder_khodam(H,v,iter);
i1=find(vHat_BitFilip ~= v);
i2=find(v_hatWbf ~= v);
i3=find(vBF ~= v);
i4=find(v_hatkhodam ~= v);
if i2==z
disp('seucsessful WBF');
else
synd1=sum(synWbf);
disp(synd1);
end
if i3==z
disp('seucsessful BF');
else
synd2=sum(sBF);
disp(synd2);
end
if i4==z
disp('seucsessful khodam damam garm');
else
synd3=sum(skhodam);
disp(synd3);
end
if i1==z
disp('seucsessful BitFliping');
else
synd4=sum(sBitFilip);
disp(synd4);
end
end]
[/CODE]
function [synd,vHat] = decodeBitFlip(rx, H, iteration)
% Hard-decision/bit flipping sum product algorithm LDPC decoder
%
% rx : Received signal vector (column vector)
% H : LDPC matrix
% iteration : Number of iteration
%
% vHat : Decoded vector (0/1)
%
%
% Copyright Bagawan S. Nugroho, 2007
%
http://bsnugroho.googlepages.com
rx=rx';
[M N] = size(H);
% Prior hard-decision
ci = 0.5*(sign(rx') + 1);
% Initialization
rji = zeros(M, N);
% Asscociate the ci matrix with non-zero elements of H
qij = H.*repmat(ci, M, 1);
% Iteration
for n = 1:iteration
% ----- Horizontal step -----
for i = 1:M
% Find non-zeros in the column
c1 = find(H(i,
);
% Get the summation of qij\c1(k)
for k = 1:length(c1)
rji(i, c1(k)) = mod(sum(qij(i, c1)) + qij(i, c1(k)), 2);
end % for k
end % for i
% ------ Vertical step ------
for j = 1:N
% Find non-zero in the row
r1 = find(H
, j));
% Number of 1s in a row
numOfOnes = length(find(rji(r1, j)));
for k = 1:length(r1)
% Update qij, set '1' for majority of 1s else '0', excluding r1(k)
if numOfOnes + ci(j) >= length(r1) - numOfOnes + rji(r1(k), j)
qij(r1(k), j) = 1;
else
qij(r1(k), j) = 0;
end
end % for k
% Bit decoding
if numOfOnes + ci(j) >= length(r1) - numOfOnes
vHat(j) = 1;
else
vHat(j) = 0;
end
end % for j
if mod(vHat*H',2)==0,break,end
end % for n
synd=mod(vHat*H',2);