0% found this document useful (0 votes)
47 views3 pages

Experiment 4 Object:: If The Property... Is Set To... Then Is..

This document discusses Low-Density Parity-Check (LDPC) codes, which are linear error control codes that can achieve performance near the Shannon limit. LDPC codes use sparse parity-check matrices and long block lengths. The document describes how to encode and decode messages using LDPC encoding and decoding objects in MATLAB, including generating codewords from messages, computing log-likelihood ratios, and iteratively decoding received signals over an AWGN channel. An example program is provided to demonstrate the encoding, modulation, transmission over a channel with noise, demodulation, and decoding process.

Uploaded by

Shivratan Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views3 pages

Experiment 4 Object:: If The Property... Is Set To... Then Is..

This document discusses Low-Density Parity-Check (LDPC) codes, which are linear error control codes that can achieve performance near the Shannon limit. LDPC codes use sparse parity-check matrices and long block lengths. The document describes how to encode and decode messages using LDPC encoding and decoding objects in MATLAB, including generating codewords from messages, computing log-likelihood ratios, and iteratively decoding received signals over an AWGN channel. An example program is provided to demonstrate the encoding, modulation, transmission over a channel with noise, demodulation, and decoding process.

Uploaded by

Shivratan Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

0112EC071102 EC-2 (BIST)

EXPERIMENT 4
OBJECT:
Simulation of Low-Density Parity-Check (LDPC) codes with LDPC encoder and decoder.

INTRODUCTION :
Low-Density Parity-Check (LDPC) codes are linear error control codes with:
 Sparse parity-check matrices
 Long block lengths that can attain performance near the Shannon limit (see fec.ldpcenc and
fec.ldpcdec)
The decoding process is done iteratively. If the number of iterations is too small, the algorithm
may not converge. You may need to experiment with the number of iterations to find an
appropriate value for your model. For details on the decoding algorithm, see Decoding
Algorithm.

LAB WORK:

LDPC Encoding Method


This object has a method encode that is used to encode signals.
codeword = encode(l, msg) encodes msg using the LDPC code specified by the LDPC encoder
object l. msg must be a binary 1-by-NumInfoBits vector.
codeword is a binary 1-by-BlockLength vector. The first NumInfoBits bits are the information
bits (msg) and the last NumParityBits bits are the parity bits. The modulo-2 matrix product of
ParityCheckMatrix and codeword' is a zero vector.

This program demonstrates the use of this object.


% Construct a default LDPC encoder object
l = fec.ldpcenc;

% Generate a random binary message


msg = randint(1,l.NumInfoBits,2);

% Encode the message


codeword = encode(l, msg);

% Verify the parity checks (which should be a zero vector)


paritychecks = mod(l.ParityCheckMatrix * codeword', 2);

Decoding Method

This object has a method decode that is used to decode signals.


decoded = decode(l, llr) decodes an LDPC code using the message-passing algorithm, where l is an
LDPC decoder object and llr is a 1-by-BlockLength vector.
The results returned in decoded depends on the parameters of the LDPC decoder object.

If the property... is set to... then decoded is...


DecisionType 'Hard decision' The decoded bits. See Decoding Algorithm.
DecisionType 'Soft decision' The log-likelihood ratios for the decoded bits.
OutputFormat 'Information part' A 1-by-NumInfoBits vector.
OutputFormat 'Whole codeword' A 1-by-BlockLength vector.

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY,BHOPAL


0112EC071102 EC-2 (BIST)

This method uses the properties DecisionType, OutputFormat, NumIterations, and DoParityChecks, and
updates the values for FinalParityChecks, and ActualNumIterations.

Decoding Algorithm

This program demonstrates the use of this object.


enc = fec.ldpcenc; % Construct a default LDPC encoder object

% Construct a companion LDPC decoder object


dec = fec.ldpcdec;
dec.DecisionType = 'Hard decision';
dec.OutputFormat = 'Information part';
dec.NumIterations = 50;
% Stop if all parity-checks are satisfied
dec.DoParityChecks = 'Yes';

% Generate and encode a random binary message


msg = randint(1,enc.NumInfoBits,2);
codeword = encode(enc,msg);

% Construct a BPSK modulator object


modObj = modem.pskmod('M',2,'InputType','Bit');

% Modulate the signal (map bit 0 to 1 + 0i, bit 1 to -1 + 0i)


modulatedsig = modulate(modObj, codeword);

% Noise parameters
SNRdB = 1;
sigma = sqrt(10^(-SNRdB/10));

% Transmit signal through AWGN channel


receivedsig = awgn(modulatedsig, SNRdB, 0); ...
% Signal power = 0 dBW

% Visualize received signal


scatterplot(receivedsig)
% Construct a BPSK demodulator object to compute
% log-likelihood ratios
demodObj = modem.pskdemod(modObj,'DecisionType','LLR', ...
'NoiseVariance',sigma^2);

% Compute log-likelihood ratios (AWGN channel)


llr = demodulate(demodObj, receivedsig);

% Decode received signal


decodedmsg = decode(dec, llr);

% Actual number of iterations executed


disp(['Number of iterations executed = ' ...
num2str(dec.ActualNumIterations)]);
% Number of parity-checks violated
disp(['Number of parity-checks violated = ' ...
num2str(sum(dec.FinalParityChecks))]);
% Compare with original message
disp(['Number of bits incorrectly decoded = ' ...
num2str(nnz(decodedmsg-msg))]);

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY,BHOPAL


0112EC071102 EC-2 (BIST)

OUTPUT

Number of iterations executed = 5


Number of parity-checks violated = 0
Number of bits incorrectly decoded = 0

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY,BHOPAL

You might also like