资源简介

///请注意:一定要看到最后!关于QC-LDPC码的编码和译码程序,之前上传了编码程序,这个是在其基础上,又添加了译码模块,和一个主程序main.m,主要是看迭代次数或码长或码率对误码率的影响。这个matlab运行时间会有点长,要有耐心。程序和前面的一样,简单易懂!!!切记是运行main.m程序,看清楚奥。//资源如果可以的话,记得好评哦,毕竟是自己辛辛苦苦做出来的。谢谢你们了!

资源截图

代码片段和文件信息

%BP迭代译码算法
function Outputdecode=LDPCDecode(SignrowcolblockHsigmaIterNum)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%clear
%clc
%row=16;col=32;block=4;SNR=1;k=1;
%H=GenH(rowcolblock);
%InputM=randint(116*4);
%PerEncode=LDPCEncode(InputMrowcolblockH);
%[SignOutputCodeErrCodesigma]=BPSKAn(PerEncodeSNR)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   PerData用于误比特判断
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

rows=row*block;
cols=col*block;
LLRsigma=sigma;
IterNumLen=length(IterNum);

%%%%%%%%%%%%%%%%%%%%%%%%%%
ErrDecode=zeros(1IterNumLen);
%Outputdecode=zeros(IterNumLencols);
%Outputdecode=zeros(2cols);

%信道初始LLR值
LLRInitial=zeros(1cols);
for i=1:cols
    LLRInitial(1i)=2*Sign(1i)/(LLRsigma^2);
end
LLRQ=zeros(rowscols);  %变量点到校验点的LLR信息
LLRR=zeros(rowscols);  %校验点到变量点的LLR信息

%初始化LLRQ
for i=1:rows
    for j=1:cols
        if H(ij)~=0
            LLRQ(ij)=LLRInitial(1j); 
        end
    end
end


%迭代过程
%maxiter=IterNum(IterNumLen);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%OutputdecodeNum=zeros(maxitercols);
Outputdecode=zeros(1cols);
%m=1;
for iter=1:IterNum
   
    %校验点到变量点的LLR计算
    for i=1:rows
        for j=1:cols
            if H(ij)~=0%判断H矩阵不为0的点进行迭代计算
                
                LLRRPro=1;%计算LLRR中Beita的积
                
                %计算变量节点传向校验节点的消息
                for k=1:cols
                    if H(ik)~=0&&k~=j%利用H矩阵对LLRQ值进行判断
                        LLRRPro=LLRRPro*tanh(LLRQ(ik)/2);
                    end
                end
                
                %信息为0时的处理
                if LLRRPro~=0
                    LLRR(ij)=2*atanh(LLRRPro);
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %if LLRR(ij)==inf||LLRR(ij)==-inf
                    %    LLRR(ij)=0;
                    %end
                else
                    LLRR(ij)=0;
                end
            end
        end
    end
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %LLRR
    %变量点到校验点的LLR计算
    for i=1:cols
        for j=1:rows
            LLRMid=0;
            if H(ji)~=0
                for k=1:rows
                    if k~=j&&H(ki)~=0
                        LLRMid=LLRR(ki)+LLRMid;%外信息加上除去本身的信道信息
                    end
                end
                LLRQ(ji)=LLRMid+LLRInitial(1i);%出过错
            end
        end
    end
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %LLRQ
    
    %迭代后码字判断
    LQ=zeros(1cols);
   
    %计算后验概率
    for i=1:cols 
        LQMid=0;
        for j=1:rows
            LQMid=LLRR(ji)+LQMid;
        end
        LQ(1i)=LQMid+LLRInitial(1i);
    end
    
    %估计码字
    decode=zeros(1cols);
    %%%%%%%%%%%%%%%%%%
    %LQ
    for i=1:cols
        if LQ(1i)<0
            decode(1i)=1;
        end
    end
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %decode
    %SUM=sum(abs(PerData-decode(1:(length(PerData)))))
    %迭代次数判断以及译码码字和误比特输出
    %if IterNum(1m)==iter
      %  ErrDecode(1m)=sum(abs

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        4103  2011-09-15 12:56  QC-LDPC-迭代次数\LDPCDecode.m
     文件        5052  2020-02-29 15:54  QC-LDPC-迭代次数\main.m
     文件        2229  2012-06-23 10:32  QC-LDPC-迭代次数\QCEncode.m
     文件        2273  2020-02-27 16:05  QC-LDPC-迭代次数\QCLDPCbaseH.m

评论

共有 条评论