0% found this document useful (0 votes)
4 views

hdlc

The document is a lab manual for the Digital Communication Lab (BECL504) at Yenepoya Institute, detailing the course objectives, outcomes, and experiments related to digital communication techniques. It includes sections on the department's vision, mission, educational objectives, and specific outcomes, along with instructions for students and descriptions of various experiments such as Amplitude Shift Keying and Phase Shift Keying. The manual aims to equip students with practical skills in digital modulation and communication system design.

Uploaded by

Vishwa naykodi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

hdlc

The document is a lab manual for the Digital Communication Lab (BECL504) at Yenepoya Institute, detailing the course objectives, outcomes, and experiments related to digital communication techniques. It includes sections on the department's vision, mission, educational objectives, and specific outcomes, along with instructions for students and descriptions of various experiments such as Amplitude Shift Keying and Phase Shift Keying. The manual aims to equip students with practical skills in digital modulation and communication system design.

Uploaded by

Vishwa naykodi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

BECL504 Digital Communication Lab

Yenepoya Institute of
N.H.13, Thodar, Moodbidri- 574225, Mangaluru, DK
(Sponsored by Islamic Academy of Education)

Technology
DIGITAL COMMUNICATION LAB MANUAL

Vsemester (ECE)
Subject Code: BECL504

Department of Electronics & Communication Engineering

Dept. of ECE, YIT MOODBIDRI 1 | Page


BECL504 Digital Communication Lab

Contents
Vision of the Department: ........................................................................................................................ 3
Mission of the Department: ...................................................................................................................... 3
Program Educational Objectives (PEOs): ................................................................................................ 3
Program Outcomes (PO’s): ...................................................................................................................... 3
Program Specific Outcomes (PSO’s): ...................................................................................................... 4
Course Description: .................................................................................................................................. 6
Course Objectives:.................................................................................................................................... 6
Course Outcomes (COs): .......................................................................................................................... 6
Course-PO/PSO Correlation Matrix: ........................................................................................................ 7
Instructions to the Students ...................................................................................................................... 8
1. Generation and demodulation of the Amplitude Shift Keying signal. ......................................... 9
2.Generation and demodulation of the Phase Shift Keying signal. ................................................ 12
3.Generation and demodulation of the Frequency Shift Keying signal.......................................... 16
4.Generation of DPSK Signal and Detection of Data Using DPSK Transmitter and Receiver. .... 19
5 .Gram-Schmidt Orthogonalization: To find orthogonal basis vectors for the given set of vectors
and plot the orthonormal vectors. ................................................................................................... 22
6.Simulation of binary baseband signals using a rectangular pulse and estimate the BER for
AWGN channel using matched filter receiver................................................................................ 24
7.Perform the QPSK Modulation and demodulation. Display the signal and its constellation. Aim:
Write a MATLAB program to perform the QPSK Modulation and demodulation. Display the
signal and its constellation.............................................................................................................. 26
8.Generate 16-QAM Modulation and obtain the QAM constellation ............................................ 28
9.Encoding and Decoding of Huffman code .................................................................................. 30
10. Encoding and decoding of binary data using a Hamming code. .............................................. 32
11. CRC-CCITT polynomial to obtain the CRC code.................................................................... 34
12. Encoding and decoding of Convolution code........................................................................... 37

Dept. of ECE, YIT MOODBIDRI 2 | Page


BECL504 Digital Communication Lab

Vision of the Department:


To inspire innovations to carve a niche in the field of Electronics and Communication
Engineering by inculcate a spirit of creative thinking and train the students in present
technologies to meet industrial as well as social needs.

Mission of the Department:


1. To continuously keep abreast with current trends and technology that support the students
to excel in Electronics and Communication Engineering.
2. Provide ethical and value based education by promoting activities addressing the social
and industrial needs.
3. Equip students with a steady foundation in Electronics and Communication technology
concepts to enable them for continuing education.

Program Educational Objectives (PEOs):


1. Graduates will be able to excel in professional career or higher education by acquiring
required up to date knowledge in area of Electronics and Communication Engineering.
2. Graduates will be able to analyze real life problems, design appropriate systems to
provide solutions that are technically sound, economically feasible and socially
acceptable.
3. Graduates will be able to exhibit professionalism, ethical attitude, communication skills
and team work and adapt to current trends by engaging in lifelong learning.

Program Outcomes (PO’s):


The engineering graduates will be able to,
● Engineering knowledge: apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex
engineering problems.
● Problem analysis: identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first
principles of mathematics, natural sciences, and engineering sciences.
● Design/development of solutions: design solutions for complex engineering
problems and design system components or processes that meet the specified needs
with appropriate consideration for the public health and safety, and the cultural,
societal, and environmental considerations.
● Conduct investigations of complex problems: use research-based knowledge and
research methods including design of experiments, analysis and interpretation of
data, and synthesis of the information to provide valid conclusions.
● Modern tool usage: create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
● The engineer and society: apply reasoning informed by the contextual knowledge
to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
● Environment and sustainability: understand the impact of the professional
engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.
● Ethics: apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.

Dept. of ECE, YIT MOODBIDRI 3 | Page


BECL504 Digital Communication Lab

● Individual and team work: function effectively as an individual, and as a member


or leader in diverse teams, and in multidisciplinary settings.
● Communication: communicate effectively on complex engineering activities with
the engineering community and with society at large, such as, being able to
comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.
● Project management and finance: demonstrate knowledge and understanding of
the engineering and management principles and apply these to one’s own work, as a
member and leader in a team, to manage projects and in multidisciplinary
environments.
● Life-long learning: recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological
change.

Program Specific Outcomes (PSO’s):


1. Graduates will be able to Analyze and design analog & digital circuits using
fundamentals of electronics engineering and build systems which will be useful for
the society.
2. Graduates will be able to implement functional blocks of hardware and software for
signal processing and communication applications along with automation systems
to process different signals.
.

Dept. of ECE, YIT MOODBIDRI 4 | Page


BECL504 Digital Communication Lab

VTU SYLLABUS

Dept. of ECE, YIT MOODBIDRI 5 | Page


BECL504 Digital Communication Lab

Course Description:
The course introduces some of the basic mathematical concepts that will allow us to think in
the two approaches of Communications, the time domain and the frequency domain. It covers
the basic types of analog modulation (AM, FM, and phase modulation) from both a
mathematical description and from a block-diagram system approach. This course presents
the fundamentals of analog communications. Topics include the analysis of signals and
systems, noise effect random process and digital data representation.

Course Objectives:
This course will enable the students to:
1 Design of basic digital modulation techniques using electronic hardware.

2 Simulation of vector computations and derive the orthonormal basis set using Gram Schmidt
procedure.
3 Simulate the digital transmission and reception in AWGN channel

4 Simulate the digital modulations using software and display the signals and its vector
representations.
5 Implement the source coding algorithms using a suitable software platform.

Course Outcomes (COs):


DESCRIPTION OF COURSE OUTCOME
CO RBTL
After completion of the course, the students will be able to:

1 Design the basic digital modulation and demodulation circuits for


L1, L2, L3
different engineering applications.
2 Design of optimum communication receivers for AWGN channels. L1, L2, L3
Illustration of different digital modulations using the signals and its L1, L2, L3
3
equivalent vector representations.
4 Implement the source coding procedures using suitable software. L1, L2, L3
5 Implement the channel coding procedures using suitable software. L1, L2, L3

Dept. of ECE, YIT MOODBIDRI 6 | Page


BECL504 Digital Communication Lab

Course-PO/PSO Correlation Matrix:


Course
Course Title POs Mapped PSOs Mapped
code
Digital Communication Lab PO1, PO2, PO3,
BECL504 PSO1, PSO2
PO4, PO5
Program
Specific
Course Program Outcomes (POs) Outcomes
Outcomes
(PSOs)
(Cos)
1 2 3 4 5 6 7 8 9 10 11 12 1 2
1. 3 2 3 3 3
2. 3 2 2 3 3 3
3. 3 3 3 2 3
4. 3 3 2 3 3 3
5. 3 2 2 3 2 3
Average COs
mapping to POs 5 5 2 1 5 5 5
/ PSOs
Course Outcome addresses Program Outcomes: 1–slight, 2– Moderate, 3 – Substantial

CO Articulation/Reason for correlation (mapping)


1 CO1 is mapped with PO1, PO5 highly and PO2 moderately as students will
be able to apply the knowledge of modulation techniques
CO1 mapped to PSO1 and PSO2 highly as students will be able to Analyze
& design the embedded & communication circuits
2 CO2 is mapped with PO1, PO5 highly and PO2, PO3 moderately as
students will be able to apply the knowledge of modulation techniques &design
the PLL modulator
CO2 mapped to PSO1 and PSO2 highly as students will be able to Analyze
& design the embedded & communication circuits
3 CO3 is mapped with PO1 and PO2, PO5 highly as students will be able to
learn different types of noises & analyze the noise factor
CO3 mapped to PSO1 moderately and PSO2 highly as students will be able
to Analyze & design the embedded & communication circuits
4 CO4 is mapped with PO1 and PO2, PO5 highly and PO4 moderately as
student will learn to apply the knowledge of modulation techniques, noise
present in receiver model & investigate the affective parameters in
communication model
CO4 mapped to PSO1 and PSO2 highly as students will be able to Analyze
& design the embedded & communication circuits

Dept. of ECE, YIT MOODBIDRI 7 | Page


BECL504 Digital Communication Lab

5 CO5 is mapped with PO1 highly and PO2, PO5 and PO3 moderately as
student will learn to apply the knowledge of Digital modulation techniques
CO5 mapped to PSO1 moderately and PSO2 highly as students will be able
to Analyze & design the embedded & communication circuits

Instructions to the Students


1. Should come on time with thorough preparation for the experiment to be conducted.
2. Should bring the practical record fully completed in all respects pertaining to the experiment
conducted in the previous lab/s.
3. After completion of the experiment, certification of the concerned Faculty -in-charge in the
observation book is necessary.
4. Turn off the systems/Fans/Lights after use.
5. Keep the lab premises clean and tidy.
6. Do not misbehave in the laboratory.
7. Do not touch, connect or disconnect any plug/cable/flash drive without your
Faculty/laboratory technician’s permission.
8. Do not read or modify other users' files.
9. Replace the materials/equipment in proper place after work.
10. Ask your Faculty-in-charge or lab technician for assistance if you have any problem.

Dept. of ECE, YIT MOODBIDRI 8 | Page


BECL504 Digital Communication Lab

Experiment No. 1
1. Generation and demodulation of the Amplitude Shift Keying signal.
Aim:To generate and demodulate the Amplitude Shift Keying signal.

Components Required:
Transistor SLlOO, Resistors 22kΩ, 2.2kΩ, DRB, DCB, OpAmp 1C741, Diode-OA79.

Theory:
In ASK, the amplitude of the carrier assumes one of the two amplitudes dependent on the logic
states of the input bit stream. The binary data stream (0s and 1s) is used to modulate the carrier
signal.
• "1": The carrier signal may be transmitted at a high amplitude.
• "0": The carrier signal may be transmitted at a lower amplitude (or may be completely
absent in the case of On-Off Keying).
A high-frequency carrier wave 𝒄(𝒕) = 𝑨𝒄𝒐𝒔(𝟐𝝅𝒇𝒄𝒕)𝒄(𝒕) (where 𝑨 is the amplitude and 𝑓𝑐 is
the frequency) is modulated based on the binary data.

Fig: ASK signal (below) and the message (above)

Design:
Specification:
Let Vc = 5 volts peak-to-peak, Vm =10 volts peak-to-peak, fm = 500 Hz, fc =50 kHz. Assume
hfe= 30, VBEsat= 0.7 volts, VCEsat= 0.3 volts, Ic=1 mA, Ic = Ie.

Biasing:
Ve peak = VCEsat + IeRe
2.5 = 0.3 + (1 m)Re, => Re = 2.2 kΩ
Vm peak = RbIb+VBEsat+IeRe
5 = RbIb + 0.7 + 2.2, where Ib=Ic/hfe
then Rbmax = 6.3 kΩ , Choose Rb = 22 k Ω

Envelope Detector:
1/fm > RdCd > 1/fc, hence 2ms > RdCd > 20µs
Let RdCd =50/fc=1 ms Assume Cd=0.01 µF,
Then Rd=100 kΩ

Dept. of ECE, YIT MOODBIDRI 9 | Page


BECL504 Digital Communication Lab

Circuit Diagram:

Procedure:

1. Connections are made as shown in the circuit diagram.


2. Apply a square wave modulating signal of 500 Hz (1000bits/sec) of 10Vp-p.
3. Apply a sine wave carrier signal of 50 kHz of 5V peak-to-peak amplitude.
4. Observe ASK waveform.
5. Demodulate the ASK signal using the envelope detector.

Tabular column: (modulation)

Amplitude Frequency
(V) (kHz)
Message signal Theoretical
,m(t) Practical
Carrier signal, Theoretical
c(t) Practical

After demodulation:

Amplitude Frequency
(V) (kHz)
Input signal

Dept. of ECE, YIT MOODBIDRI 10 | Page


BECL504 Digital Communication Lab

Output signal

Expected Waveform:

Result:

ASK signal is generated and demodulated.

Dept. of ECE, YIT MOODBIDRI 11 | Page


BECL504 Digital Communication Lab

Experiment No. 2
2.Generation and demodulation of the Phase Shift Keying signal.
Aim: To generate and demodulate the PSK signal.

Component Required: Op-amp 741, Diodes OA79, Transistor CL100, Resistor 15KΩ,
33KΩ, 10KΩ etc.

Theory:
In PSK, the carrier signal undergoes phase changes based on the binary data (or multi-level
symbols) being transmitted. These phase shifts represent different data values. The simplest
form of PSK is Binary Phase Shift Keying (BPSK), where the carrier signal has two possible
phase states to represent binary values.
Bit "0" might correspond to a phase of 0 degrees.
Bit "1" might correspond to a phase of 180 degrees (or π radians).
Thus, the carrier signal is reversed in phase to represent the binary data.

The carrier signal for PSK is typically represented as:


𝐶𝑎𝑟𝑟𝑖𝑒𝑟 𝑠𝑖𝑔𝑛𝑎𝑙 = 𝐴𝑐𝑜𝑠(2𝜋𝑓𝑐𝑡 + 𝜙) where:
o A = amplitude of the signal
o 𝑓𝑐 = carrier frequency
o ϕ = phase shift (which will vary based on the data)
For BPSK, the phase ϕ can take two values:
• Phase = 0 for bit "0".
• Phase = π (or 180 degrees) for bit "1".

Procedure:

1. Rig up the circuit for PSK generation as shown in the diagram.


2. Apply sinusoidal carrier signal of Vpp = 5V.
3. Apply square wave message signal (pulse) of Vpp = 8 to 10V
4. Adjust the amplitude and frequency of the signals to obtain clear PSK signal.
5. Record the observations.
6. Feed the PSK signal to demodulation circuit along with carrier signal. Tune the
capacitance to get a clean recovery of the message signal.
7. Plot the waveforms.

Dept. of ECE, YIT MOODBIDRI 12 | Page


BECL504 Digital Communication Lab

PSK Generation Circuit:

PSK Detection Circuit:

Dept. of ECE, YIT MOODBIDRI 13 | Page


BECL504 Digital Communication Lab

Tabular column: (modulation)

Amplitude Frequency
(V) (kHz)
Message signal Theoretical
,m(t) Practical
Carrier signal, Theoretical
c(t) Practical

After demodulation:

Amplitude Frequency
(V) (kHz)
Input signal

Output signal

Expected Waveforms:

Dept. of ECE, YIT MOODBIDRI 14 | Page


BECL504 Digital Communication Lab

Connection diagram of PSK modulator and demodulator using kit

Procedure:
1. Switch on MICRO LAB INSTRUMENTS PSK/DPSK Trainer kit.
2. Connect the carrier output of carrier SIN0 (TP3) and SIN180 (TP4) degree to the PSK/DPSK
modulator Block TP9 and TP7 respectively as show in the connection diagram.
3. Connect the serial data bit (TP14) to the Data input (TP11) of the PSK/DPSK Modulator
block.
4. Observe and sketch PSK output waveform at the test point TP13 using CRO.
5. Connect the PSK modulated signal (TP13) to the PSK Demodulator/Phase comparator test
point TP24.
6. Observe the final PSK demodulated Output at the Test point TP27.

Result:

The operation of PSK generator and detector is verified.

Dept. of ECE, YIT MOODBIDRI 15 | Page


BECL504 Digital Communication Lab

Experiment No. 3
3.Generation and demodulation of the Frequency Shift Keying signal.
Aim: To design and verify the operation of FSK generator and detector.

Components Required: Transistor-SLlOO, SKIOO, Resistors, Capacitors.

Theory:
In FSK modulation, the carrier signal's frequency is changed between two predefined values to
represent binary 0s and 1s. Typically, two frequencies, f1 and f2, are employed, corresponding
to the binary states. The selection of these frequencies is crucial for the performance of the
modulation system.
The FSK modulation process can be explained as follows:
• When the input digital data is '0,' the carrier signal is modulated to f1.
• When the input digital data is '1,' the carrier signal is modulated to f2.
This modulation process creates distinct frequency shifts that can be easily detected at the
receiver.
The mathematical representation of an FSK-modulated signal s(t) can be expressed as:

Here, A represents the amplitude of the carrier signal, and t denotes time.
Detection at the Receiver:
At the receiver, the demodulation process involves detecting the frequency of the received signal
to determine the transmitted binary data. This can be achieved through various methods,
including frequency discrimination or Fourier transform analysis.

Circuit Diagram:

Dept. of ECE, YIT MOODBIDRI 16 | Page


BECL504 Digital Communication Lab

Procedure:

1. Rig up the modulator circuit as shown in the figure.


2. Apply carrier of amplitude 2 V(P- P) and frequency 1 kHz.
3. Apply carrier of amplitude 2 V(P- P) and frequency 2 kHz.
4. Apply message signal of amplitude 10 V(P - P) and frequency of 250 Hz. .
5. Observe ASK outputs at each collector of transistor, and also observe FSK output at pin 6
of Op-amp.
6. Connect demodulator circuit.
7. Observe the demodulated output on CRO.

Tabular column: (modulation)

Amplitude Frequency
(V) (kHz)
Message signal Theoretical
,m(t) Practical
Carrier signal, Theoretical
c(t) Practical

After demodulation:

Amplitude Frequency
(V) (kHz)
Input signal

Output signal

Dept. of ECE, YIT MOODBIDRI 17 | Page


BECL504 Digital Communication Lab

Expected Waveforms:

Result:

FSK waveform is generated.

Dept. of ECE, YIT MOODBIDRI 18 | Page


BECL504 Digital Communication Lab

Experiment No.4

4.Generation of DPSK Signal and Detection of Data Using DPSK Transmitter and
Receiver.
Aim:To generate the operation of DPSK Transmitter and Receiver.

Component Required:

1. DPSK modulation and demodulation trainer kit


2. CRO
3. Connecting Wires
Theory:
Differential Phase Shift Keying (DPSK) modulation, instead of encoding the absolute phase of
the signal, the phase difference between consecutive symbols is utilized. The modulated signal
represents changes in phase rather than absolute phase values. This characteristic makes DPSK
more robust against phase variations introduced by the communication channel.

Phase Encoding:
In the DPSK transmitter, the phase of each symbol is determined relative to the phase of the
previous symbol. The phase difference, Δϕ, is used to encode the binary data.

Binary Encoding:
The binary data is differentially encoded, ensuring that each symbol represents a change in phase
from the previous symbol. This simplifies the demodulation process at the receiver.

Coherent Detection:
Coherent detection is commonly employed in DPSK demodulation. The received signal is
multiplied by a locally generated carrier signal, cos(2πfct+θ), where θ is the phase offset
between the local oscillator and the received signal.
r(t)=s(t)⋅cos(2πfct+θ)

Phase Difference Detection:


The output of the coherent detection process is passed through a phase difference detector. This
block measures the phase difference between consecutive symbols, allowing for the recovery of
the differentially encoded binary data.

Binary Decoding:
The differentially encoded binary data is differentially decoded, reconstructing the original
binary sequence based on the changes in phase between consecutive symbols.
.

Dept. of ECE, YIT MOODBIDRI 19 | Page


BECL504 Digital Communication Lab

Connection diagram of DPSK modulator and demodulator with EX-NOR differential


encoder and decoder:

Procedure:

1. Switch on MICRO LAB INSTRUMENTS PSK/DPSK Trainer kit.


2. Connect the carrier output of carrier SIN0 (TP3) and SIN180 (TP4) degree to the PSK/DPSK
modulator Block TP9 and TP7 respectively as show in the connection diagram.

Dept. of ECE, YIT MOODBIDRI 20 | Page


BECL504 Digital Communication Lab

3. Connect the Data Bit output (TP14) to the Differential Encoder -1(EXNOR Logic) input at
test point TP16.
4. Observe the Differential data output at the TP19 using CRO.
5. Connect the Differential Encoder -1 output (TP19) to the input of PSK/DPSK modulator
Block test point TP11.
6. Observe the DPSK signal at the test point TP13.
7. Connect the PSK/DPSK output (TP13) to the PSK/DPSK Demodulator block test point TP24.
8. Observe the DPSK Demodulated output at Test point TP 27 using CRO.
9. The frequency of modulation data signal should be equal to the demodulated O/P.

Connection diagram of DPSK modulator and demodulator with EX-OR differential


encoder and decoder:

Procedure:
1. Switch on MICRO LAB INSTRUMENTS PSK/DPSK Trainer kit.
2. Connect the carrier output of carrier SIN0 (TP3) and SIN180 (TP4) degree to the PSK/DPSK
modulator Block TP9 and TP7 respectively as show in the connection diagram.
3. Connect the Data Bit output (TP14) to the Differential Encoder coder -2(EX-OR logic) input
at test point TP20.
4. Observe the differential data with EX-OR logic at the output of the Differential Encoder -2
at test point TP23.
5. Connect the Differential Encoder -2 output at Test point TP23 to Data input (TP11) of
PSK/DPSK Modulator block.
6. Observe the DPSK output at the test point TP13.
7. Connect the DPSK signal to PSK/DPSK Demodulator test point (TP23)
8. Observe DPSK demodulated data at the test point TP27.

Result:
The operation of DPSK is observed and the output waveforms are verifie

Dept. of ECE, YIT MOODBIDRI 21 | Page


BECL504 Digital Communication Lab

Experiment No. 5
5 .Gram-Schmidt Orthogonalization: To find orthogonal basis vectors for the given set of
vectors and plot the orthonormal vectors.
Aim: Write a MATLAB Code to find orthogonal basis vectors for the given set of vectors and
plot the orthonormal vectors.

Software : MATLAB R2013a.

Theory :
The Gram-Schmidt Orthogonalization process is a method used to convert a set of linearly
independent vectors into an orthogonal (or orthonormal) set of vectors. In digital
communication, particularly in multiple access systems, signal modulation schemes, or
multiple-input multiple-output (MIMO) systems, the Gram-Schmidt process is used to create
orthogonal signal vectors that minimize interference between transmitted signals, enhancing the
performance of the communication system.

Procedure:
1. Open MATLAB version R2013a
2. Open new file and enter the program and save it.
3. Add the path to the location of the file in the system.
4. Compile the program and check for any error and debug it.
5. Note down the output.

Program

% Define the set of vectors (example set).Each column represents a vector

A = [1 3; 4 -7; -1 -12];
[m, n] = size(A); % Initialize matrices for orthogonal and normalized vectors%
Q = zeros(m, n);
QN = zeros(m, n);

% Gram-Schmidt process to find orthonormal vectors


for j = 1:n
v = A(:, j);
for i = 1:j-1
rij = Q(:, i).' * A(:, j) / (Q(:, i).' * Q(:, i));
v = v - rij * Q(:, i);
end
Q(:, j) = v;
if norm(v) ~= 0 % Avoid division by zero
QN(:, j) = v / norm(v);
end
end

% Display the orthonormal vectors


Dept. of ECE, YIT MOODBIDRI 22 | Page
BECL504 Digital Communication Lab

disp('Orthonormal vectors (QN):');


disp(QN);

% Plotting the orthonormal vectors


figure;
hold on;
axis equal;
grid on;

% Plot each orthonormal vector


for i = 1:n
quiver(0, 0, QN(1, i), QN(2, i), 0, 'LineWidth', 2, 'MaxHeadSize', 2, 'DisplayName', ['Vector
' num2str(i)]);
end

% Customize plot
xlabel('X-axis');
ylabel('Y-axis');
title('Orthonormal Vectors');
legend show;

Result: orthogonal basis vectors for the given set of vectors are found and the orthonormal
vectors are plotted .

Dept. of ECE, YIT MOODBIDRI 23 | Page


BECL504 Digital Communication Lab

Experiment No. 6
6.Simulation of binary baseband signals using a rectangular pulse and estimate the BER
for AWGN channel using matched filter receiver.
Aim: To write a MATLAB program for simulation of binary baseband signals using a
rectangular pulse and estimate the BER for AWGN channel using matched filter receiver.
Software: MATLAB R2013a.
Theory: Binary baseband signals are transmitted using rectangular pulses for binary 1s and
0s.The matched filter receiver is used to maximize the SNR and make the decision based on the
received signal.In the presence of AWGN, the receiver will make errors when the noise causes
the decision variable to cross the threshold incorrectly.The Bit Error Rate (BER) for binary
baseband signals with rectangular pulses in an AWGN channel can be calculated using the Q-
2A2
function: 𝐵𝐸𝑅 = 𝑄 (√ N )
0

Procedure:
1. Open MATLAB version R2013a
2. Open new file and enter the program and save it.
3. Add the path to the location of the file in the system.
4. Compile the program and check for any error and debug it.
5. Note down the output.
Program:
clc;
clear all;
close all ;
% Initialize key variables.
T_bit = 10; % 1/T_bit is the bit rate
num_bits = 300; % Desired number of bits in generated signal
%% Create the baseband signal, Create bit sequence.
bit_seq = randi([0 1], [1 num_bits]);

% Create symbol sequence from bit sequence.


sym_seq = 2*bit_seq - 1;
zero_mat = zeros((T_bit - 1), num_bits);
sym_seq = [sym_seq ; zero_mat];
sym_seq = reshape(sym_seq, 1, T_bit*num_bits);

% Create pulse function.


p_of_t = ones(1, T_bit);

% Convolve bit sequence with pulse function.


s_of_t = filter(p_of_t, [1], sym_seq);

% Plot time-domain waveform.


figure(1);
plot(s_of_t(1:200),'linewidth', 2 );
xlabel('Sample Index');
ylabel('Signal Amplitude');
Dept. of ECE, YIT MOODBIDRI 24 | Page
BECL504 Digital Communication Lab

title('Time-Domain Plot of Rectangular-Pulse BPSK (T_{bit} = 10, f_c = 0)');


ip = s_of_t>0; % generating 0,1 with equal probability
s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 1
n = 1/sqrt(2)*[randn(1,num_bits) + j*randn(1,num_bits)]; % white gaussian noise, 0dB
variance
Eb_N0_dB = [-3:10]; % multiple Eb/N0 values
for ii = 1:length(Eb_N0_dB)

% Noise addition
y = s + 10^(-Eb_N0_dB(ii)/20)*num_bits; % additive white gaussian noise

% receiver - hard decision decoding


ipHat = real(y)>0;

% counting the errors


nErr(ii) = size(find([ip- ipHat]),2);
end
simBer = nErr/num_bits; % simulated ber
theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber
% plot
figure
semilogy(Eb_N0_dB,theoryBer,'b.-');
hold on
semilogy(Eb_N0_dB,simBer,'mx-');
axis ([-3 10 10^-5 0.5])
grid on
legend('theory', 'simulation');
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('Bit error probability curve for BPSK modulation');
Output:

Result: binary baseband signals using a rectangular pulse is simulated and BER for AWGN
channel using matched filter receiver is estimated.

Dept. of ECE, YIT MOODBIDRI 25 | Page


BECL504 Digital Communication Lab

Experiment No 7:
7.Perform the QPSK Modulation and demodulation. Display the signal and its
constellation.
Aim: Write a MATLAB program to perform the QPSK Modulation and demodulation. Display
the signal and its constellation.
Software: MATLAB R2013a.

Theory : QPSK works by changing the phase of the carrier signal to represent pairs of bits. In
this scheme, each symbol represents two bits, and there are four possible symbols in total, each
represented by a different phase.
Each pair of bits is mapped to one of four possible symbols, typically represented as:
• 00 → Phase 0° (or π/4\pi/4π/4 radians)
• 01 → Phase 90° (or 3π/43\pi/43π/4 radians)
• 10 → Phase 180° (or 5π/45\pi/45π/4 radians)
• 11 → Phase 270° (or 7π/47\pi/47π/4 radians)
The modulated signal can be expressed as a real and imaginary component corresponding to the
in-phase and quadrature components of the carrier signal. The signal is then transmitted over
the communication channel.

The goal of QPSK demodulation is to recover the original bit stream from the received signal.
This is done by detecting the phase of the received signal, mapping the phase back to the
corresponding bit pair, and then reconstructing the original data stream. The received signal is
affected by noise, which can be modeled as an Additive White Gaussian Noise (AWGN)
channel. The received signal r(t) can be written as:
r(t)=s(t)+n(t)
Where s(t) is the transmitted signal, and n(t) is the noise

Procedure:
1. Open MATLAB version R2013a
2. Open new file and enter the program and save it.
3. Add the path to the location of the file in the system.
4. Compile the program and check for any error and debug it.
5. Note down the output.

Program:
clc;
clear all;
close all;
N=100 ; %number of symbols to be generated
dataIn= randi([0 3],N,1); %data Generation
txSig = pskmod(dataIn,4,pi/4); %modulation
rxSig = awgn(txSig,20); %transmission through awgn channel

Dept. of ECE, YIT MOODBIDRI 26 | Page


BECL504 Digital Communication Lab

dataOut = pskdemod(rxSig,4,pi/4);%demodulation

%plotting
subplot(2,1,1), stem(1:N,dataIn);
xlabel('sample Number');
title('Input Data for modulation');
subplot(2,1,2),stem(1:N,dataOut);
xlabel('sample Number');
title('Output Data after demodulation');

%constlellation diagram
scatterplot(txSig)
title('Constellation Diagram of Tx Signal');
scatterplot(rxSig)
title('Contellation Diagram of Rx Signal');

Output:

Result : constellation diagram of QPSK Modulation and demodulation is displayed.

Dept. of ECE, YIT MOODBIDRI 27 | Page


BECL504 Digital Communication Lab

Experiment No 8:
8.Generate 16-QAM Modulation and obtain the QAM constellation.
Aim:Write a MATLAB Program to generate 16-QAM Modulation and obtain the QAM
constellation.

Software: MATLAB R2013a.

Theory : 16-QAM (16-Quadrature Amplitude Modulation) is a widely used modulation scheme


in digital communication systems that combines amplitude modulation (AM) and phase
modulation (PM) to transmit 4 bits per symbol. In QAM, both the amplitude and phase of a
carrier signal are varied, enabling multiple bits to be encoded in each symbol. 16-QAM uses 16
distinct signal points (or symbols) on the complex plane, which are mapped to 4-bit
combinations It is a form of multilevel modulation, where the carrier signal takes on different
values depending on the amplitude and phase.
Amplitude and Phase are used to encode data in 2 dimensions:
o The I (In-phase) component determines the amplitude of the signal in the real
direction.
o The Q (Quadrature) component determines the amplitude of the signal in the
imaginary direction.
The goal of 16-QAM is to send data with a higher rate compared to simpler schemes like QPSK
or BPSK, using the same bandwidth.

Procedure:
1. Open MATLAB version R2013a
2. Open new file and enter the program and save it.
3. Add the path to the location of the file in the system.
4. Compile the program and check for any error and debug it.
5. Note down the output.

Program
clc;
clear all;
close all;

N=100;
d = randi([0 15], N, 1); % Generate data symbols
sym = qammod(d,16); % Generate modulated symbols
rcv = awgn(sym, 20); % Additive White Gaussian Noise
stem(1:N,d);
xlabel('Sample Number');
title('Data to be modulated');
scatterplot(rcv); % View constellation

Dept. of ECE, YIT MOODBIDRI 28 | Page


BECL504 Digital Communication Lab

Output:

Result : 16-QAM Modulation is generated and QAM constellation is obtained.

Dept. of ECE, YIT MOODBIDRI 29 | Page


BECL504 Digital Communication Lab

Experiment No 9:
9.Encoding and Decoding of Huffman code.

Aim:To write a MATLAB program for encoding and decoding of Huffman code
Software: MATLAB R2013a.
Theory: Huffman coding, developed by David A. Huffman in 1952, is a widely employed
algorithm for lossless data compression. It is based on the principle of entropy encoding and is
particularly efficient in constructing variable-length codes for symbols based on their frequency
of occurrence in a given dataset. This lab experiment aims to explore the Huffman coding
algorithm, understand its construction, and observe its efficiency in compressing data.
Procedure:
1. Open MATLAB version R2013a
2. Open new file and enter the program and save it.
3. Add the path to the location of the file in the system.
4. Compile the program and check for any error and debug it.
5. Note down the output.

Program:
clc;
clear all;
close all;

symbols = 1:6;
p = [.5 .125 .125 .125 .0625 .0625]; %probability should be equal to 1
bps = ceil(log2(max(symbols))); % Bits per symbol

dict = huffmandict(symbols,p); %creating dictionary


disp('The dictionary is')
disp(dict)
N=100; %length of signal
inputSig = randsrc(N,1,[symbols;p]); %input signal

code = huffmanenco(inputSig,dict); %huffman encode


sig = huffmandeco(code,dict); %huffman decode

subplot(2,1,1),stem(1:N, inputSig);
xlabel('Sample Number');
title('Input data for encoding');
subplot(2,1,2),stem(1:N,sig);
xlabel('Sample Number');
title('Output data after decoding');

Dept. of ECE, YIT MOODBIDRI 30 | Page


BECL504 Digital Communication Lab

Output:

Result : Encoding and decoding of Huffman code is performed.

Dept. of ECE, YIT MOODBIDRI 31 | Page


BECL504 Digital Communication Lab

Experiment No 10:
10. Encoding and decoding of binary data using a Hamming code.
Aim:Write a MATLAB program for encoding and decoding of binary data using a Hamming
code.

Software: MATLAB R2013a.

Theory: Hamming Code is an error-detecting and error-correcting code widely used in digital
communication systems. It adds redundancy to the transmitted data to detect and correct
errors, ensuring data integrity during transmission.

Principles of Hamming Code:


● Parity Bits: Hamming Code utilizes parity bits to add redundancy to the original data.
Parity bits are additional bits appended to the data to create a codeword with a specific
structure.
● Positioning of Parity Bits: The positions of the parity bits in the codeword are crucial.
They are placed at positions that are powers of 2 (1, 2, 4, 8, ...). The remaining bits are
for the original data.
● Calculation of Parity Bits: The value of each parity bit is determined by checking
specific bits in the data. For example, Parity Bit 1 checks every bit that has the least
significant bit of its binary representation set to 1.
Hamming Distance:
● The Hamming distance between two codewords is the number of positions at which the
corresponding bits are different. In Hamming Code, the minimum Hamming distance
between codewords is crucial for error detection and correction.
● A distance of 1 can detect single-bit errors, and a distance of 2 can correct single-bit
errors.
Error Detection and Correction:
● Error Detection: If a received codeword has an odd number of errors, it can be detected
using the parity bits. The position of the error can be determined by identifying the parity
bit affected.
● Error Correction: If a received codeword has a single-bit error, the position of the error
can be determined, and the bit flipped to correct the error.

Procedure:

1. Open MATLAB version R2013a


2. Open new file and enter the program and save it.
3. Add the path to the location of the file in the system.
4. Compile the program and check for any error and debug it.
5. Note down the output.

Dept. of ECE, YIT MOODBIDRI 32 | Page


BECL504 Digital Communication Lab

Program

clc;
clear all;
close all;

n = 15; % Codeword length


k = 11; % Message length

data = randi([0 1],k,1); %data generation


encData = encode(data,n,k,'hamming/binary'); % encoding the data
errLoc = randerr(1,n);
encData = mod(encData + errLoc',2); %Corrupt the encoded message by introducing an
error at a random location.
decData = decode(encData,n,k,'hamming/binary');

subplot(2,1,1),stem(1:k, data);
xlabel('Sample Number');
title('Input data for encoding');
subplot(2,1,2),stem(1:k,decData );
xlabel('Sample Number');
title('Output data after decoding');

Output:

Result : Encoding and decoding of binary data using a Hamming code is performed..

Dept. of ECE, YIT MOODBIDRI 33 | Page


BECL504 Digital Communication Lab

Experiment No 11:
11. CRC-CCITT polynomial to obtain the CRC code.
Aim: Write a C Program for a given data, use CRC-CCITT polynomial to obtain the CRC
code. Verify for the cases, a)Without error b)With error

Operating System: UBUNTU

Theory:Cyclic Redundancy Check (CRC) is an error-detection technique widely used in


digital communication systems. The CRC-CCITT polynomial is a specific polynomial used
for CRC in many applications. This small theory provides an overview of CRC-CCITT and
outlines the structure of a C program to generate CRC codes for given data.
The CRC-CCITT polynomial is defined as x16+x12+x5+1. This polynomial is often represented
as 0x1021 in hexadecimal form.
The CRC code is generated by dividing the input data by the CRC polynomial using bitwise
XOR operations. The resulting remainder becomes the CRC code appended to the original data.

Program

#include<stdio.h>
#include<string.h>
#define N strlen(genpoly)

char data[50],checksum[50], genpoly[]="1010";


inta,e,c;

void xor()
{
for(c = 1;c < N; c++)
checksum[c] = (( checksum[c] == genpoly[c])?'0':'1');
}

void crc()
{
for(e=0;e<N;e++)
checksum[e]=data[e];
do
{
if(checksum[0]=='1')
xor ();
for(c=0;c<N-1;c++)
checksum[c]=checksum[c+1];
checksum[c]=data[e++];
}
while(e<=a+N-1);
}

int main()
{
printf("\nEnter data : ");
scanf("%s",data);
Dept. of ECE, YIT MOODBIDRI 34 | Page
BECL504 Digital Communication Lab

printf("\n\nGeneratng polynomial : %s",genpoly);


a=strlen(data);
for(e=a;e<a+N-1;e++)
data[e]='0';

printf("\n\nModified data is : %s",data);


crc();

printf("\n\nChecksum is : %s",checksum);
for(e=a;e<a+N-1;e++)
data[e]=checksum[e-a];

printf("\n\nFinalcodeword is : %s",data);

printf("\n\nTest error detection 0(yes) 1(no)? : ");


scanf("%d",&e);
if(e==0)
{
do
{
printf("\nEnter the position where error is to be inserted : ");
scanf("%d",&e);
}
while(e==0 || e>a+N-1);
data[e-1]=(data[e-1]=='0')?'1':'0';
printf("\n\nErroneous data : %s\n",data);
}
crc();

for(e=0;(e<N-1) && (checksum[e]!='1');e++);


if(e<N-1)
printf("\nError detected\n\n");
else
printf("\nNo error detected\n\n");
return 0;
}
Output:
Case 1: Case 2:
Enter data : 11101101 Enter data : 11111
Generatingpolynomial : 1010 Generating polynomial : 1010
Modified data is : 11101101000 Modified data is : 11111000
Checksum is : 110 Checksum is : 001
Final code word is : 11101101110 Final code word is : 11111001
Test error detection 0(yes) 1(no)? : 1 Test error detection 0(yes) 1(no)? : 0
No error detected Enter the position where error is to be
inserted : 2
Erroneous data : 10111001
Error detected

Dept. of ECE, YIT MOODBIDRI 35 | Page


BECL504 Digital Communication Lab

Result : C Program for a given data, using CRC-CCITT polynomial,CRC code is obtained
and Verified for the cases, a)Without error b)With error.

Dept. of ECE, YIT MOODBIDRI 36 | Page


BECL504 Digital Communication Lab

Experiment No 12:
12. Encoding and decoding of Convolution code.
Aim:Write a MATLAB Program for encoding and decoding of Convolution code.

Software : MATLAB software R2013a.

Theory: Convolutional coding is an error-correcting technique used in digital communication


systems to enhance the reliability of data transmission. Unlike block codes such as Hamming
or Reed-Solomon codes, convolutional codes operate on a continuous stream of data and are
particularly effective in combating burst errors.
Encoding Process:
● Generator Polynomials: Convolutional codes are defined by generator polynomials.
These polynomials dictate the connections between the shift registers and determine how
the input bits contribute to the output.
● Trellis Diagram: The encoding process of convolutional codes can be visualized using
a trellis diagram, where each node represents a state and each branch corresponds to a
transition based on an incoming bit.
Decoding Process:
● Viterbi Algorithm: The Viterbi algorithm is commonly employed for decoding
convolutional codes. It uses the trellis diagram to find the most likely sequence of states
that produced the received sequence, thus minimizing the probability of error.
● Soft Decision Decoding: Convolutional codes are often decoded using soft decision
metrics, taking into account the reliability of received bits rather than treating them as
binary.

Procedure:
1. Open MATLAB version R2013a
2. Open new file and enter the program and save it.
3. Add the path to the location of the file in the system.
4. Compile the program and check for any error and debug it.
5. Note down the output.

Program

clc;
clear all;
close all;
K=3;
G1=7;
G2=5;
N=15;
msg= randi([0 1],1,N); %data Generation
trel=poly2trellis(K,[G1 G2]);
coded=convenc(msg,trel); %convlutional encoder
tblen = length(msg);
decoded=vitdec(coded,trel,tblen,'trunc','hard'); %viterbi algorithm

Dept. of ECE, YIT MOODBIDRI 37 | Page


BECL504 Digital Communication Lab

subplot(2,1,1), stem(1:N,msg)
xlabel('sample Number')
title('message signal')
subplot(2,1,2),stem(1:N,decoded)
xlabel('sample Number')
title('decoded outptut of viterbi algorithm')

Output:

Result : Encoding and decoding of Convolution code is performed.

Dept. of ECE, YIT MOODBIDRI 38 | Page

You might also like