【问题标题】:How to decode LDPC如何解码 LDPC
【发布时间】:2019-10-17 13:37:20
【问题描述】:

我生成一个奇偶校验矩阵,并使用 comm.LDPCEncoder 对码字进行编码。但是,当我使用 comm.LDPCDecoder 解码 LLR 时,解码后的字与源不同。 你能帮我找出哪里错了吗?

K = 4;N = 8;
H1 =  [0 0 0 1 1 0 1 1;
    0 0 0 0 1 1 0 0
    1 1 0 0 0 0 0 1
    0 0 1 0 0 1 0 1];
H = sparse(H1);
hEnc = comm.LDPCEncoder(H);
hDec = comm.LDPCDecoder(H);
msg_source = logical(randi([0 1], K, 1));
msg_coded = step(hEnc, msg_source);  
LLR = double(msg_coded);
msg_decoded = step(hDec,LLR);
errors = (sum(xor(msg_source,msg_decoded)));

非常感谢。

【问题讨论】:

    标签: matlab


    【解决方案1】:

    看起来LLR = double(msg_coded); 是问题的根源。

    我不是通信专家,从未使用过 LDPC 编码器和解码器。
    我尝试了 MATLAB 代码示例,发现在调制和解调之后,1s(一)得到负值,0s(零)得到正值。

    而不是LLR = double(msg_coded);
    您可以使用以下转换:LLR = 1 - double(msg_coded)*2;.
    0 --> 1
    1 --> -1

    这里是修改后的代码:

    K = 4;N = 8;
    H1 =  [0 0 0 1 1 0 1 1;
        0 0 0 0 1 1 0 0
        1 1 0 0 0 0 0 1
        0 0 1 0 0 1 0 1];
    H = sparse(H1);
    hEnc = comm.LDPCEncoder(H);
    hDec = comm.LDPCDecoder(H);
    msg_source = logical(randi([0 1], K, 1));
    msg_coded = step(hEnc, msg_source);  
    %LLR = double(msg_coded);
    
    %Convert from logical to double where 0 goes to -1 and 1 goes to 1.
    LLR = 1 - double(msg_coded)*2;
    msg_decoded = step(hDec,LLR);
    errors = (sum(xor(msg_source,msg_decoded)));
    

    这是我用于查找问题的调制和解调代码(基于 MATLAB 示例):

    K = 4;N = 8;
    H1 =  [0 0 0 1 1 0 1 1;
        0 0 0 0 1 1 0 0
        1 1 0 0 0 0 0 1
        0 0 1 0 0 1 0 1];
    H = sparse(H1);
    hEnc = comm.LDPCEncoder(H);
    hDec = comm.LDPCDecoder(H);
    
    hMod = comm.PSKModulator(4, 'BitInput',true);
    hChan = comm.AWGNChannel(...
            'NoiseMethod','Signal to noise ratio (SNR)','SNR',10);
    hDemod = comm.PSKDemodulator(4, 'BitOutput',true,...
            'DecisionMethod','Approximate log-likelihood ratio', ...
            'Variance', 1/10^(hChan.SNR/10));
    
    msg_source = logical(randi([0 1], K, 1));
    msg_coded = step(hEnc, msg_source);  
    
    modSignal      = step(hMod, msg_coded);
    receivedSignal = step(hChan, modSignal);
    demodSignal    = step(hDemod, receivedSignal);
    msg_decoded   = step(hDec, demodSignal);
    
    errors = (sum(xor(msg_source,msg_decoded)));
    

    【讨论】:

      【解决方案2】:

      为什么要将逻辑编码数据转换为双精度?编码后尝试解码:

      K = 4;N = 8;
      H1 =  [0 0 0 1 1 0 1 1;
          0 0 0 0 1 1 0 0
          1 1 0 0 0 0 0 1
          0 0 1 0 0 1 0 1];
      H = sparse(H1);
      hEnc = comm.LDPCEncoder(H);
      hDec = comm.LDPCDecoder(H);
      msg_source = logical(randi([0 1], K, 1));
      msg_coded = step(hEnc, msg_source);  
      msg_decoded = step(hDec,LLR);
      errors = (sum(xor(msg_source,msg_decoded)));
      

      【讨论】:

        猜你喜欢
        • 2018-04-09
        • 2020-11-22
        • 1970-01-01
        • 2020-07-27
        • 2014-12-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-27
        相关资源
        最近更新 更多