首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何解码LDPC

如何解码LDPC
EN

Stack Overflow用户
提问于 2019-10-17 21:37:20
回答 2查看 295关注 0票数 0

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

代码语言:javascript
复制
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)));

非常感谢。

EN

回答 2

Stack Overflow用户

发布于 2019-10-18 00:50:33

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

我不是一个通信专家,也从未使用过LDPC编码器和解码器。

我尝试了MATLAB代码样本,发现经过调制和解调后,1s (1)为负值,0s (0)为正值。

代替LLR = double(msg_coded);

您可以使用以下转换:LLR = 1 - double(msg_coded)*2;

0 --> 1

1 --> -1

修改后的代码如下:

代码语言:javascript
复制
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示例):

代码语言:javascript
复制
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)));
票数 0
EN

Stack Overflow用户

发布于 2019-10-21 19:35:59

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

代码语言:javascript
复制
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)));
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58434030

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档