簡體   English   中英

如何解碼 LDPC

[英]How to decode LDPC

我生成一個奇偶校驗矩陣,並使用 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)));

太感謝了。

看起來LLR = double(msg_coded); 是問題的根源。

我不是通信專家,從未使用過 LDPC 編碼器和解碼器。
我嘗試了 MATLAB 代碼示例,看到調制解調后, 1 s(1)得到負值, 0 s(0)得到正值。

而不是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)));

為什么要將邏輯編碼數據轉換為double? 嘗試在編碼后解碼:

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)));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM