Você está na página 1de 5

ber = zeros(length(snrVec),1);

returns 1 coloumn of 0's of length of snrVec

ex- snrVec= 1 2 3

ber= [0 0 0]'
Low-density parity-check (LDPC) codes are a class of linear block LDPC codes. The name
comes from the characteristic of their parity-check matrix which contains only a few 1’s in
comparison to the amount of 0’s. Their main advantage is that they provide a performance which
is very close to the capacity for a lot of different channels and linear time complex algorithms for

Basically there are two different possibilities to represent LDPC codes. Like all linear block
codes they can be described via matrices. The second possibility is a graphical representation.

The two types of nodes in a Tanner graph are called variable nodes (c-nodes) and check nodes (f-

A LDPC code is called regular if Wc is constant for every column and Wr = Wc · (n/m) is also
constant for every row. There is the same number of incoming edges for every v-node and also
for all the c-nodes.

If H is low density but the numbers of 1’s in each row or column aren’t constant the code is
called a irregular LDPC code.

ldpcEnc = comm.LDPCEncoder; % creates an LDPC encoder system object ‘ldpcEnc’ that performs
encoding operation.
ldpcDec = comm.LDPCDecoder; % creates an LDPC decoder system object ‘ldpcDec’ that performs
decoding operation.

Create a QPSK modulator, a QPSK demodulator, and an Error Rate detector.

qpskMod = comm.QPSKModulator('BitInput',true); % creates QPSKModulator system object that

modulates a signal.
qpskDemod = comm.QPSKDemodulator('BitOutput',true,...
'DecisionMethod','Approximate log-likelihood ratio', ...
'VarianceSource','Input port'); % demodulates a signal
errorCnt = comm.ErrorRate;

Create a vector of SNR values to evaluate. Initialize the bit error rate vector.

snrVec = [0 0.2 0.4 0.6 0.65 0.7 0.75 0.8];

ber = zeros(length(snrVec),1);

Encode, modulate, and transmit 32400-bit frames of binary data through an AWGN channel. Then,
demodulate, decode, and estimate the bit error rate.

for k = 1:length(snrVec)
noiseVar = 1/10^(snrVec(k)/10);
errorStats = zeros(1,3);
while errorStats(2) <= 200 && errorStats(3) < 5e6
data = logical(randi([0 1],32400,1)); % Generate binary data
encData = ldpcEnc(data); % Apply LDPC encoding
modSig = qpskMod(encData); % Modulate
rxSig = awgn(modSig,snrVec(k)); % Pass through AWGN channel
demodSig = qpskDemod(rxSig,noiseVar); % Demodulate
rxData = ldpcDec(demodSig); % Decode LDPC
errorStats = errorCnt(data,rxData); % Compute error stats

% Save the BER for the current Eb/No and reset the error rate counter
ber(k) = errorStats(1);

Plot the bit error rate.

xlabel('SNR (dB)')
ylabel('Bit Error Rate')