📄 ldpc_decode_log.m
字号:
function [uhat,vhat]=ldpc_decode_log(rx_waveform,No,amp,h,rearranged_cols)
%global H;
[M,N]=size(h);
L=zeros(1,N);
vhat(1,1:N)=0;
zero(1,1:M)=0;
Lq=+h;
Lr=+h;
%%%%%% Initialization %%%%%%%%%
sigma2=No/2;
L=2.*amp.*rx_waveform./sigma2;
for i=1:M
L1(i,:)=L;
end
Lq=Lq.*L1;
%%%%%% Iterations:100 %%%%%%
for iteration=1:100
%%%%%%%%%%% begin horizontal step %%%%%%%%%%%%%%%%%%%%%%
for j=1:M
bit=find(h(j,:)~=0);
for i=1:length(bit)
tem=bit(find(bit~=bit(i)));
alfa=prod(sign(Lq(j,tem)));
beta=-log(tanh(sum(-log(tanh(abs(Lq(j,tem))./2)))/2));
Lr(j,bit(i))=alfa.*beta;
end
end
%%%%%%%%%%%%%% end horizontal step %%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%% begin vertical step %%%%%%%%%%%%%%%%%%%
for i=1:N
check=find(h(:,1)==1);
for j=1:length(check)
tem=check(find(check~=check(j)));
Lq(check(j),i)=L(i)+sum(Lr(tem,i));
end
end
%%%%%%%%%%%%%%%%%%% end vertical step %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%% tentative decoding %%%%%%%%%%%%%%%%%%%
LQ=L;
for i=1:N
check=find(h(:,i)~=0);
LQ(i)=LQ(i)+sum(Lr(check,i));
if LQ(i)>0
vhat(i)=1;
end
end
%%%%%%%%%%%%%%%%%%% stop if vhat*H'=0 %%%%%%%%%%%%%%%%%%%
if mul_GF2(vhat,h')==zero
break;
end
end
uhat = extract_mesg(vhat,rearranged_cols);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -