필터 지우기
필터 지우기

LDPC Code simulation with soft decoding

조회 수: 9 (최근 30일)
Jongmin
Jongmin 2024년 2월 15일
답변: Jaswanth 2024년 5월 8일
Hi. I'm trying to create an LDPC code simulation for learning.
The code I made earlier is as follows.
% Define DVB-S.2 LDPC code parameters
dvbS2Rate = 1/2; % Code rate for demonstration
dvbS2ldpc = dvbs2ldpc(dvbS2Rate); % Get the
LDPC object for DVB-S.2
numInfoBits = size(dvbS2ldpc, 2) - size(dvbS2ldpc, 1); % Number of information bits
% Set up simulation parameters
SNR_dB = 1:10; % SNR range from 1 to 10 dB
Nstop = 1000; % Number of frames to simulate
WER = zeros(1, length(SNR_dB)); % Pre-allocate WER for each SNR value
% Create LDPC encoder and decoder objects
ldpcEncoder = comm.LDPCEncoder('ParityCheckMatrix', dvbS2ldpc);
ldpcDecoder = comm.LDPCDecoder('ParityCheckMatrix', dvbS2ldpc, 'DecisionMethod', 'Soft decision');
% Simulation loop over SNR values
for snr_idx = 1:length(SNR_dB)
% Convert SNR from dB to linear scale for noise variance
SNR_linear = 10^(SNR_dB(snr_idx) / 10);
noiseVar = 1 / (2 * SNR_linear * (1/dvbS2Rate));
% Create AWGN channel object
awgnChannel = comm.AWGNChannel('NoiseMethod', 'Variance', 'Variance', noiseVar);
% Initialize error counters
numberOfBitErrors = 0;
numberOfWordErrors = 0;
for frame = 1:Nstop
% Generate random information bits
infoBits = logical(randi([0 1], numInfoBits, 1));
% LDPC encoding
encodedBits = ldpcEncoder(infoBits);
% BPSK Modulation
modulatedSignal = 2 * double(encodedBits) - 1;
% Pass through AWGN Channel
receivedSignal = awgnChannel(modulatedSignal);
% BPSK Demodulation
receivedBits = receivedSignal < 0;
% LDPC Decoding
decodedBits = ldpcDecoder(double(receivedBits));
% Calculate the number of bit errors
bitErrors = sum(infoBits ~= logical(decodedBits));
numberOfBitErrors = numberOfBitErrors + bitErrors;
numberOfWordErrors = numberOfWordErrors + (bitErrors > 0);
end
% Calculate WER for the current SNR
WER(snr_idx) = numberOfWordErrors / Nstop;
end
% Plot the WER vs SNR graph
figure;
semilogy(SNR_dB, WER, 'b-o');
xlabel('SNR in E_b/N_0 in dB');
ylabel('WER');
title('Word Error Rate vs. SNR for DVB-S.2 LDPC Code');
grid on;
But Result is..
Like that.. So I wondered
  댓글 수: 1
Jongmin
Jongmin 2024년 2월 15일
The Ideal result is this(It is hard decision result when I run that code)

댓글을 달려면 로그인하십시오.

채택된 답변

Jaswanth
Jaswanth 2024년 5월 8일
Hi Jongmin,
In your LDPC code simulation for a DVB-S.2 setup, the key issue lies in the input format expected by the decoder. Your current approach uses binary bits, whereas the decoder requires Log-Likelihood Ratios (LLRs). To resolve this, you need to modify the demodulation phase to calculate LLRs from the received signals, considering the noise variance.
Please refer to the following response given by a MathWorks Staff member for potentially helpful information.
Also, it is advised in MathWorks documentation to use ldpcEncode over comm.LDPCEncoder, which will be discontinued in future updates. Please refer to following MathWorks documentation to learn more about ldpcEncode: https://www.mathworks.com/help/comm/ref/ldpcencode.html
I hope the information provided above is helpful in accomplishing your task.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Error Detection and Correction에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by