ldpc using matlab function
Show older comments
Hi,
here my matlab code for 16-QAM over AWGN channel using LDPC matlab function. I get a BER which is worse than the one without code. Does somebody have any idea about what is wrong with my code?
% Set the simulation parameters.
clear; close all
rng default
M = 16; % Modulation order
k = log2(M); % Bits per symbol
EbNoVec = (0:10)'; % Eb/No values (dB)
numSymPerFrame = 1000; % Number of QAM symbols per frame
rate=1/2;
% Set LDPC coding and decoding
hEnc = comm.LDPCEncoder;
hDec = comm.LDPCDecoder;
for n = 1:length(EbNoVec)
n
% Convert Eb/No to SNR
snrdB = EbNoVec(n) + 10*log10(k*rate);
% Generate binary data and convert to symbols
dataIn = (randi([0 1],32400,1));
% Convolutionally encode the data
dataEnc = step(hEnc, dataIn);
% QAM modulate
txSig = qammod(dataEnc,M,'InputType','bit');
% Pass through AWGN channel
rxSig = awgn(txSig,snrdB,'measured');
% Demodulate the noisy signal using hard decision (bit) and
% approximate LLR approaches
rxDataSoft = qamdemod(rxSig,M,'OutputType','approxllr', ...
'NoiseVariance',10.^(snrdB/10));
% LDPC decoding
receivedBits = step(hDec, rxDataSoft);
% Ber computation
[umErrsInFrameSoft, BER(n)] = biterr(receivedBits,dataIn);
end
semilogy(EbNoVec,BER,...
EbNoVec,berawgn(EbNoVec,'qam',M),'-*')
legend('LDPC','Uncoded')
grid
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')
3 Comments
Rostislav Shaniiazov
on 16 Nov 2018
All theoretical boards are for rate = 1. You used rate =1/2.
Rishi Balasubramanian
on 21 Jan 2021
check SNRdB calculation
ikram DAANOUNE
on 1 Feb 2021
@Thomas Larhzaoui did you solve this problem?
Answers (1)
Raed Abd-Alhameed
on 23 May 2021
0 votes
Remove the noise variance in the qamdemod function. The errors will be zero for most of teh EbNo values... I meant water falling approach occurs. Please try it and let me know, otherwise if you have another solution please let me know.
Categories
Find more on Error Detection and Correction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!