ldpc using matlab function

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

All theoretical boards are for rate = 1. You used rate =1/2.
check SNRdB calculation
@Thomas Larhzaoui did you solve this problem?

Sign in to comment.

Answers (1)

Raed Abd-Alhameed
Raed Abd-Alhameed on 23 May 2021
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.

Tags

Asked:

on 21 Sep 2016

Answered:

on 23 May 2021

Community Treasure Hunt

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

Start Hunting!