0% found this document useful (0 votes)
38 views54 pages

S6 Ec Manual October 10th

Uploaded by

rishikesh tp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views54 pages

S6 Ec Manual October 10th

Uploaded by

rishikesh tp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

COMMUNICATION LAB

B. Tech Degree 6th Semester


COMMUNICATION LABORATORY
MANUAL
(2019 Scheme)
Vision:
“To be a supreme centre of quality Electronics Engineering education with a focus on lifelong
learning, teamwork and leadership, thus creating a platform for industrial consultancy with
global standards through intense research, contributing meaningfully to the development of
the country.”

Mission
 Work with commitment to the highest possible standards of quality in the areas of
teaching, research and service
 Develop a full-fledged Centre of learning in various fields of Electronics &
Communication Engineering
 Produce competent engineers adequately prepared to face challenges of the society,
adhering to moral and ethical values

Department of Electronics Engineering, School of Engineering


Cochin University of Science And Technology

DOE,SOE Page | 1
COMMUNICATION LAB

SYLLABUS

19-203-0611 COMMUNICATION LABORATORY

Course Outcomes:
On successful completion of teaching-learning and valuation activities, a
student would be able To design circuits of different analog
modulation techniques like AM, FM etc., its generation and
demodulation.
To design different pulse modulation techniques
like PAM, generation and demodulation
To simulate digital communication systems and evaluate its performance

Experiments:
1. Amplitude modulation anddemodulation
2. Frequency modulation
3. PAM modulator and demodulator
4. Simulation of digital and analog communication systems
5. Digital modulation techniques and it performance measures
6. Matched filter receiver for rectangular pulse.
7. Error correction & coding & LPDC, Viterbi algorithm

Reference:

1. Contemporary Communication Systems Using MATLAB,


Third Edition John G. Proakis,Masoud Salehi , Gerhard Bauch

DOE,SOE Page | 2
COMMUNICATION LAB

LIST OF EXPERIMENTS
PART A - Hardware Experiments

Part A1 - Analog Communication

1. Analog Pulse Modulation - PAM modulator and demodulator

Part A2 - Digital Communication

2. BASK modulator and demodulator


3. BPSK modulator and demodulator
4. BFSK modulator and demodulator

PART B - MATLAB Experiments

Part B1 - Analog Communication

5. Analog modulation

Part B2 - Digital Communication

6. Passband Digital Modulation


a. ASK
b. PSK
c. FSK
7. M-ary Modulation
a. M-ary PSK
b. M-ary ASK (digital PAM)
c. M-ary FSK
8. Line Codes (Baseband Transmission)
9. Baseband to Passband Conversion
10. Matched filter
a. Matched filter receiver for rectangular pulse
b. BER vs SNR - Matched filter
11. Channel Coding (Error detection & correction)
a. Linear Block Code - Hamming Code

DOE,SOE Page | 3
COMMUNICATION LAB

Introduction - Communication System

The key components of a communication system are as follows

Figure: Block Diagram of Communication system

Information Source:

 It creates a message signal (e.g. voice signal, music, video signal, e-mail). The message
signal is also called a baseband signal since it is usually lower frequency.
 Message signals contain information to be sent to the recipient.
 Message signal is converted into electrical form using a suitable transducer. E.g. A
microphone converts acoustic voice signals into electrical signals.

Transmitter: It is an electronic device containing circuits that convert original message signal
into transmitted signal that is more suitable for transmission over channel medium. The
transmitter consists of subsystems such as modulator, mixer, RF amplifier etc. The most
important process within the transmitter is usually modulation.

Channel:

 It is the transmission medium between the transmitter and the receiver.


 This physical medium can be wired (e.g. copper wire, optic fiber) or wireless (e.g.
bluetooth, satellite)
 The signal attenuation increases with length of channel.

Noise is undesirable energy of random nature and it affects the signals passing through the
channel.

Receiver: It is an electronic device containing circuits that accept the transmitted signals from
the channel medium and convert them back to message signals. Receiver performs the reverse
operations of the transmitter such as demodulation. The receiver also has band pass filters to
select the required signal from among other transmitted signals which may also be sharing
(multiple access) the channel. This is called tuning and such a circuit is called a tuner.

DOE,SOE Page | 4
COMMUNICATION LAB

Modern Wireless Communication System

The block diagram of modern wireless communication system can be broadly divided into two
parts:

 BASEBAND PART – consists of modulator, source and channel encoders. The output of this
stage is IF (Intermediate Frequency). Modern modulators use a DSP followed by a DAC.
o This part are covered in this LAB
 RF PART – consists of a mixer [which converts the IF (usually a few MHz) to RF (e.g. 2.4 GHz
for Bluetooth)] and RF amp whose output is radiated by the antenna. The RF part is made out
of microwave integrated circuits in portable devices and tubes in high power devices.
o This part shall be covered in S7 - 19-203-0712 Microwave Engineering
Laboratory

Transmitter

Transceiver

SSPA – Solid State power amplifier (RF microwave amp using semiconductor microwave
devices), LNA – Low Noise Amplifier (RF microwave amp)

Example – Bluetooth Modem

DOE,SOE Page | 5
COMMUNICATION LAB

Part AI and B1 - Analog Communication


Based on: 19-203-0405 Communication Engineering I

DOE,SOE Page | 6
COMMUNICATION LAB

Part A2 and B2 - Digital Communication


Based on: 19-203-0503 Communication Engineering II and 19-203-0604 Information Theory
& Coding

In a digital communication system (e.g. 2G/3G/4G, Wi-Fi etc), the message signal is digital data
(sequence of 1s and 0s). The message may be already in digital form (e.g. text string, FILE such as
spreadsheet, PDF, digital photo etc) or analog signal (e.g. voice) converted to digital by an ADC.

This digital message is input to the transmitter. The functional blocks of the transmitter and the
corresponding reverse operations at the receiver are paired as follows

 source encoder–decoder
 channel encoder–decoder
 modulator–demodulator

The source encoder removes redundant information from the message (e.g. RLC, Huffman,
Arithmetic, LZW etc). Ideally, we would like to represent the message using as few bits as possible i.e.
data compression happens. The resulting sequence of symbols is called the source codeword.

The data stream is processed next by the channel encoder, which produces a new sequence of
symbols called the channel codeword. The channel codeword is longer than the source code
word because they are formed by inserting extra bits. The channel codewords include the

DOE,SOE Page | 7
COMMUNICATION LAB

information bits, plus additional bits (e.g. parity bits) that are used for error detection and
correction. The extra bits are redundant; that is, they carry no new information. However, the
receiver uses these bits to determine when an error occurs and correct a certain number of
errors.

Different types of channel codes

The output of the channel encoder is also a digital data stream and this is input to the modulator.

The source output consists of a sequence of 1s and 0s (bitstream – of digital data), with each
binary symbol being emitted every Tb (bit duration) seconds.
The modulator takes the 1s and 0s emitted by the source and maps them into distinct signals
denoted by s1(t) and s2(t), respectively, which are suitable for transmission over the analog
channel.

DOE,SOE Page | 8
COMMUNICATION LAB

Channel is represented by an AWGN model, depicted in the Figure below.

The received signal is defined by

where w(t) is the channel noise.

The receiver has the task of observing


the received signal x(t) for a duration of
Tb seconds
and then making an estimate of the
transmitted signal si(t), or equivalently
the ith symbol.

However, owing to the presence of channel noise, the receiver will inevitably make occasional
errors. The requirement, therefore, is to design the receiver so as to minimize the average
probability of symbol error, defined as

To make a digital communication system as reliable as possible the average probability of


error must be minimised.

DOE,SOE Page | 9
COMMUNICATION LAB

References Simon Haykin - Digital Communication, B P Lathi - Modern Digital and Analog
Communication Systems, John G Proakis - Digital-communications

DOE,SOE Page | 10
COMMUNICATION LAB

PART A - Hardware Experiments

Part A1 - Analog Communication

EXP NO 1: Analog Pulse Modulation - PAM modulator and demodulator

Aim: To design and set up a pulse amplitude modulation and demodulation

Theory: The basic method of generation of PAM is that the signal to be modulated must be
fed to a switch which is operated by the sampling signal. A PAM modulator using analog
switch is shown in fig below. Analog switch passes the input signal to output at a rate
determined by the clock frequency. Clock frequency as selected as per the sampling theorem.

Expected waveform

DOE,SOE Page | 11
COMMUNICATION LAB

Circuit Diagram

Modulator Circuit

Demodulator Circuit

Design:
Modulator
1
For perfect integration,𝑅𝐶 > 15𝑇 𝑤ℎ𝑒𝑟𝑒 𝑇 = 𝑓

Let the frequency of clock be 10 KHz


1
So 𝑇 = 10𝐾𝐻𝑧 = 100 × 10−6 𝑠𝑒𝑐

Let 1𝜇𝐹, 𝑡ℎ𝑒𝑛 𝑅 > 1.5𝐾Ω


𝑅 ≈ 3.3𝐾Ω

DOE,SOE Page | 12
COMMUNICATION LAB

Part A2 - Digital Communication

EXP NO 2 BASK modulator and demodulator

Aim: To design and set up an ASK modulator and demodulator.


Theory: ASK stands for amplitude for amplitude shift Keying. Here two signals each of
different amplitude but some phase and frequency are used to represent a zero and one. They
are controlled by switches in CD4016 IC. The control input to the switch is the data which is a
low frequency one. When the pulse is zero, a low amplitude signal is transmitted and for one a
high amplitude signal is transmitted. The outputs of both the switches are shorted to get the
ASK output.

Circuit Diagram

BASK modulator circuit

Expected output

DOE,SOE Page | 13
COMMUNICATION LAB

BASK demodulator circuit

Procedure:
1. Set up the modulator circuit and observe the ASK output in CRO.
2. Set up the demodulator circuit and vary the port to get the desired output waveform.

Result:

DOE,SOE Page | 14
COMMUNICATION LAB

EXP NO 3: BPSK modulator and demodulator


Aim: To design and setup a BPSK generator and demodulator.
Theory: BPSK stands for Binary Phase Shift Keying. Here two signals which are 180 0 out of
phase with each other are used to represent one’s and zero’s of communications. Here CD4016
is used. The control input to the switch is the data which is a low frequency one. When the
pulse is zero the original signal is transmitted and one is encountered the out of phase signal is
transmitted.
In demodulation an adder is used to nullify the out of phase signal. Then its output is
filtered to get the regenerated pulse signal.

Circuit Diagram :

DOE,SOE Page | 15
COMMUNICATION LAB

BPSK modulator circuit

Expected output

BPSK demodulator circuit

Procedure:
1. Setup the modulator circuit as shown in the figure and unify the output.
2. Setup the demodulator circuit as shown in the figure.
3. Vary the port to get the output.Verify whether it is the same as the input pulse signal.

Result:

DOE,SOE Page | 16
COMMUNICATION LAB

EXP NO 4: BFSK Modulator


Aim: To design and set up BFSK modulator using 555 Timer IC.
Theory: In BFSK the carrier frequency is switched between two preset frequencies. FSK is
generated using Timer IC in astable mode. The output frequency is controlled by the state of
the transistor Q. The circuit generates one frequency at logic ‘1’ input and another frequency
at logic ‘0’ input.
When the input is at logic ‘1’ transistor Q is OFF. Under these conditions, 555 work as
an ordinary astable multivibrator. The frequency of operation is given by
1.45
f0   1000Hz
R A  2 RB

When the input is at logic ‘0’ transistor turns on and it connects RC across R A .

1.45
f0   1200Hz
RA RC   2RB
Circuit: BFSK modulator circuit

Expected output

DOE,SOE Page | 17
COMMUNICATION LAB

Expected output

Result:

DOE,SOE Page | 18
COMMUNICATION LAB

PART B - MATLAB Experiments


Part B1 - Analog Communication
EXP NO 5 Analog modulation and demodulation
Aim: To create and plot the waveforms and corresponding spectrum of various analog
modulation schemes such as standard AM, suppressed carrier DSB-SC, and FM
Theory:

DSB-FC (Full Carrier) - standard AM

DSB-SC (Suppressed Carrier) - Product Modulator/ Balanced Modulator

FM - Frequency Modulation

Program Code:

clc; clear all; close all;


%-------- ANALOG MODULATION --------------------
%%%%%%% parameters %%%%%%
Ts = 0.01; %sampling period
fm = 200; % message frequency in hertz
fc = 4000; % carrier frequency in hertz
Am = 3; % message amplitude
Ac = 5; % carrier amplitude
mu = Am/Ac; % modulation index of AM
t = (-2:Ts:80)*10^(-3); %time in millisecond

message = Am*cos(2*pi*fm*t); %message signal


subplot(5,2,1); plot(t,message); axis([0 0.007 -3.5 3.5]);
xlabel('t'); ylabel('m(t)'); title('message signal');
subplot(5,2,2); plot(abs(fft(message))); axis([0 600 0 inf]);
carrier = Ac*cos(2*pi*fc*t); %carrier signal

DOE,SOE Page | 19
COMMUNICATION LAB
subplot(5,2,3); plot(t,carrier); axis([0 0.007 -5.5 5.5]);
xlabel('t'); ylabel('c(t)'); title('carrier signal');
subplot(5,2,4); plot(abs(fft(carrier))); axis([200 600 0 inf]);

%%% DSB-FC - Standard AM —-------------------------------


AM = Ac*(1 + mu*cos(2*pi*fm*t)).*cos(2*pi*fc*t);
subplot(5,2,5); plot(t,AM); axis([0 0.007 -16 16]);
xlabel('t'); ylabel('AM(t)'); title('DSB-FC');
subplot(5,2,6); plot(abs(fft(AM))); axis([200 600 0 inf]);

%%% DSB-SC - BALANCED MODULATOR —-------------------------


BM = message.*carrier; % message x carrier
subplot(5,2,7); plot(t,BM); axis([0 0.007 -16 16]);
xlabel('t'); ylabel('BM(t)'); title('DSB-SC');
subplot(5,2,8); plot(abs(fft(BM))); axis([200 600 0 inf]);

%%% FM —----------------------------------------------
beta = 7; % modulation index of FM
FM = Ac*cos(2*pi*fc*t + beta*sin(2*pi*fm*t));
subplot(5,2,9); plot(t,FM); axis([0 0.007 -5.5 5.5]);
xlabel('t'); ylabel('FM(t)'); title('FM');
subplot(5,2,10); plot(abs(fft(FM))); axis([100 600 0 inf]);

Output Waveform:

Inference: The spectrum of standard AM consists of one carrier and two sidebands, whereas
for DSBSC it is sidebands only and multiple sidebands for FM.

DOE,SOE Page | 20
COMMUNICATION LAB

Result: Successfully created and plotted the waveforms and corresponding spectrum of various
analog modulation schemes such as standard AM, suppressed carrier DSB-SC, and FM

DOE,SOE Page | 21
COMMUNICATION LAB

Part B2 - Digital Communication


EXP NO 6 Passband Digital Modulation
6a Amplitude Shift Keying (ASK)
Aim:
To generate and plot the ASK waveform for the given message bit.
Theory:

Expected waveform

Program Code:

clc; clear all; close all;


%-------------------------------------------------------------
% 07-02-2022 COMMUNICATION LAB
% Digital modulation techniques and it performance measures
% ASK modulation
%-------------------------------------------------------------
data=[1,0,1,1,0,1,0,0]; % message digital data
fc=3; % frequency of carrier in Hz
Tb = 1; % bit duration
t=0:0.01:Tb;
Eb = 1; % bit energy
s1 = sqrt(2*Eb/Tb)*cos(2*pi*fc*t); % signal s1(t)
s2 = zeros(1,length(t)); % signal s2(t)

% symbol to signal mapping


if(data(1) == 1) %for bit '1'
txs = s1;
elseif(data(1) == 0) %for bit '0'

DOE,SOE Page | 22
COMMUNICATION LAB

txs = s2;
end

% repeating for remaining data bits


for i=2:length(data)
if(data(i) == 1) %for bit '1'
txs = [txs, s1];
elseif(data(i) == 0) %for bit '0'
txs = [txs, s2];
end
end
plot(txs); xlabel('time t --->'); ylabel('txs'); title('ASK')

Output:

6b Phase Shift Keying (PSK)


Aim:
To create and plot the waveform of digital modulation scheme PSK.
Theory:

DOE,SOE Page | 23
COMMUNICATION LAB

expected waveform

Program Code:

Clc;
close all;
clear all;
data=[1,0,1,1,0,1,0,0]; % message digital data
fc=0.5; % frequency of carrier in Hz
Tb = 1; % bit duration
t=0:0.01:Tb;
Eb = 1; % bit energy
s1 = sqrt(2*Eb/Tb)*cos(2*pi*fc*t); % signal s1(t)
s2 = -(sqrt(2*Eb/Tb)*cos(2*pi*fc*t)); % signal
s2(t)

% symbol to signal mapping


if(data(1) == 1) %for bit '1'
txs = s1;
elseif(data(1) == 0) %for bit '0'
txs = s2;
end

% repeating for remaining data bits


for i=2:length(data)
if(data(i) == 1) %for bit '1'
txs = [txs, s1];
elseif(data(i) == 0) %for bit '0'
txs = [txs, s2];
end
end
plot(txs); xlabel('time t --->'); ylabel('txs'); title('PSK')

DOE,SOE Page | 24
COMMUNICATION LAB

Output Waveform

6c Frequency Shift Keying (FSK)


Aim:
To create and plot the waveform of FSK
Theory:

Expected waveform

Program Code:

clc;close all;clear all


data=[1,0,1,1,0,1,0,0]; % message digital data

DOE,SOE Page | 25
COMMUNICATION LAB

f1=5;
f2=1;% frequency of carrier in Hz
Tb = 1; % bit duration
t=0:0.01:Tb;
Eb = 1; % bit energy
s1 = sqrt(2*Eb/Tb)*cos(2*pi*f1*t); % signal s1(t)
s2 = sqrt(2*Eb/Tb)*cos(2*pi*f2*t); % signal s2(t)

% symbol to signal mapping


if(data(1) == 1)
%for bit '1'
txs = s1;
elseif(data(1) == 0) %for bit '0'
txs = s2;
end

% repeating for remaining data bits


for i=2:length(data)
if(data(i) == 1) %for bit '1'
txs = [txs, s1];
elseif(data(i) == 0) %for bit '0'
txs = [txs, s2];
end
end
plot(txs); xlabel('time t --->'); ylabel('txs'); title('FSK')

DOE,SOE Page | 26
COMMUNICATION LAB

Output Waveform

Result: Successfully created and plotted the waveforms and corresponding spectrum of various
digital modulation schemes such as standard ASK, PSK and FSK.

DOE,SOE Page | 27
COMMUNICATION LAB

EXP NO 7 M-ary Modulation


7a M-ary PSK (M = 4, QPSK)
Aim:
To create and plot the Mary PSK waveform for the given message bit
Theory:
M=4

where i = 1,2 … (M-1)


expected waveform

Program Code:

clc; clear all; close all;


%-------------------------------------------------------------
% 07-02-2022 COMMUNICATION LAB
% Digital modulation techniques and it performance measures
% M-ary PSK (M = 4, QPSK)
%-------------------------------------------------------------
data=[0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 1 0 1]; % message digital
data
fc=3; % frequency of carrier in Hz
T = 1; % symbol duration
t=0:0.01:T;
E = 1; % symbol energy
s1 = sqrt(2*E/T)*cos(2*pi*fc*t + (1*pi/4)); % signal s1(t)
s2 = sqrt(2*E/T)*cos(2*pi*fc*t + (3*pi/4)); % signal s2(t)
s3 = sqrt(2*E/T)*cos(2*pi*fc*t + (5*pi/4)); % signal s3(t)
s4 = sqrt(2*E/T)*cos(2*pi*fc*t + (7*pi/4)); % signal s4(t)

% symbol to signal mapping


i = 1;
if (data(i)==1)&&(data(i+1)==0)
txs = s1;

DOE,SOE Page | 28
COMMUNICATION LAB

elseif (data(i)==0)&&(data(i+1)==0)
txs = s2;
elseif (data(i)==0)&&(data(i+1)==1)
txs = s3;
elseif (data(i)==1)&&(data(i+1)==1)
txs = s4;
end

% repeating for remaining data bits


for i=3:2:length(data)
if (data(i)==1)&&(data(i+1)==0)
txs = [txs, s1];
elseif (data(i)==0)&&(data(i+1)==0)
txs = [txs, s2];
elseif (data(i)==0)&&(data(i+1)==1)
txs = [txs, s3];
elseif (data(i)==1)&&(data(i+1)==1)
txs = [txs, s4];
end
end

plot(txs); xlabel('time t --->'); ylabel('txs'); title('M-ary


PSK (M = 4, QPSK)')

Output Waveform

7b M-ary ASK (M = 4, M-ary digital PAM)


Aim:
To create and plot the Mary ASK waveform for the given message list

DOE,SOE Page | 29
COMMUNICATION LAB

Theory:

expected waveform

Program Code:

clc; clear all; close all;


%-------------------------------------------------------------
% M-ary PSK (M = 4, APSK)
%-------------------------------------------------------------

data=[0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 1 0 1]; % message digital


data
fc=3; % frequency of carrier in Hz
T = 1; % symbol duration
t=0:0.01:T;
E = 1; % symbol energy
s1 = sqrt(2*E/T)*(-3)*cos(2*pi*fc*t); % signal s1(t)

DOE,SOE Page | 30
COMMUNICATION LAB

s2 = sqrt(2*E/T)*(-1)*cos(2*pi*fc*t); % signal s2(t)


s3 = sqrt(2*E/T)*(+1)*cos(2*pi*fc*t); % signal s3(t)
s4 = sqrt(2*E/T)*(+3)*cos(2*pi*fc*t); % signal s4(t)

% symbol to signal mapping


i = 1;
if (data(i)==0)&&(data(i+1)==0)
txs = s1;
elseif (data(i)==0)&&(data(i+1)==1)
txs = s2;
elseif (data(i)==1)&&(data(i+1)==0)
txs = s3;
elseif (data(i)==1)&&(data(i+1)==1)
txs = s4;
end

% repeating for remaining data bits


for i=3:2:length(data)
if (data(i)==0)&&(data(i+1)==0)
txs = [txs, s1];
elseif (data(i)==0)&&(data(i+1)==1)
txs = [txs, s2];
elseif (data(i)==1)&&(data(i+1)==0)
txs = [txs, s3];
elseif (data(i)==1)&&(data(i+1)==1)
txs = [txs, s4];
end
end

plot(txs); xlabel('time t --->'); ylabel('txs'); title('M-ary


ASK (M = 4)')

DOE,SOE Page | 31
COMMUNICATION LAB

Output waveform

EXP NO 7c M-ary FSK (M = 4)


Aim:
To create and plot the Mary FSK waveform for the given message list

Theory:

Program Code:

clc; clear all; close all;


%-------------------------------------------------------------
% M-ary PSK (M = 4, APSK)
%-------------------------------------------------------------

data=[0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 1 0 1]; % message digital


data
fc1=3; % frequency of carrier in Hz

DOE,SOE Page | 32
COMMUNICATION LAB

fc2=6;
fc3=9;
fc4=12;
T = 1; % symbol duration
t=0:0.01:T;
E = 1; % symbol energy
n=[1 2 3 4]
s1 = sqrt(2*E/T)*cos(2*pi*fc1*t); % signal s1(t)
s2 = sqrt(2*E/T)*cos(2*pi*fc2*t); % signal s2(t)
s3 = sqrt(2*E/T)*cos(2*pi*fc3*t); % signal s3(t)
s4 = sqrt(2*E/T)*cos(2*pi*fc4*t); % signal s4(t)

% symbol to signal mapping


i = 1;
if (data(i)==0)&&(data(i+1)==0)
txs = s1;
elseif (data(i)==0)&&(data(i+1)==1)
txs = s2;
elseif (data(i)==1)&&(data(i+1)==0)
txs = s3;
elseif (data(i)==1)&&(data(i+1)==1)
txs = s4;
end

% repeating for remaining data bits


for i=3:2:length(data)
if (data(i)==0)&&(data(i+1)==0)
txs = [txs, s1];
elseif (data(i)==0)&&(data(i+1)==1)
txs = [txs, s2];
elseif (data(i)==1)&&(data(i+1)==0)
txs = [txs, s3];
elseif (data(i)==1)&&(data(i+1)==1)

DOE,SOE Page | 33
COMMUNICATION LAB

txs = [txs, s4];


end
end

plot(txs); xlabel('time t --->'); ylabel('txs'); title('M-ary


FSK (M = 4)')

Output Waveform

Result: Successfully created and plotted different M ary modulation schemes.

DOE,SOE Page | 34
COMMUNICATION LAB

EXP NO 8 Line Codes - Baseband Transmission


Aim: To generate and plot line codes for given message signals

Theory:
Line Codes are used for electrical representation of binary data streams. In a digital
communication system, the message signal is digital data (sequence of 1s and 0s). A line code
represents them using voltage levels. Some applications of line codes include – USB, Ethernet,
optical, RS-232 etc. These electrical signals are used for wired links where modulation may
not be necessary. Since they are not modulated with a carrier their spectrum is in the
baseband region (Baseband Transmission). The choice of a line code is made by considering
which is the main concern amongst - bandwidth, bit timing recovery, noise immunity, cost and
complexity.

expected waveform

DOE,SOE Page | 35
COMMUNICATION LAB

Program Code:

clc; clear all; close all;


%-------------------------------------------------------------
% 07-02-2022 COMMUNICATION LAB
% Line Codes - Baseband Transmission
%-------------------------------------------------------------
data=[1,0,1,0,1,1,1,0,0]; % message digital data
Tb = 1; % bit duration
t=0:0.01:Tb;
Eb = 1;

% unipolar NRZ
s1uNRZ = Eb*ones(1,length(t)); % signal s1(t)
s2uNRZ = Eb*zeros(1,length(t)); % signal s2(t)

% polar NRZ
s1pNRZ = Eb*ones(1,length(t)); % signal s1(t)
s2pNRZ = -Eb*ones(1,length(t)); % signal s2(t)

% NRZi (NRZ inverted - differential encoding)


s1NRZi = Eb*ones(1,length(t)); % signal s1(t)
% HINT: invert s1 every data(i) == 1 i.e. s1NRZi = -s1NRZi

% bipolar / AMI (alternate mark inversion)


s1bip = Eb*ones(1,length(t)); % signal s1(t)
s2bip = Eb*zeros(1,length(t)); % signal s2(t)
% HINT: invert s1 every data(i) == 1 i.e. s1bip = -s1bip

% manchester / split phase


s1man = [(Eb/2)*ones(1,ceil(length(t)/2)),-
(Eb/2)*ones(1,floor(length(t)/2))]; % signal s1(t)

DOE,SOE Page | 36
COMMUNICATION LAB

s2man = [-
(Eb/2)*ones(1,ceil(length(t)/2)),(Eb/2)*ones(1,floor(length(t)
/2))]; % signal s2(t)

% symbol to signal mapping


if(data(1) == 1) %for bit '1'
txs_uNRZ = s1uNRZ; % unipolar NRZ
txs_pNRZ = s1pNRZ; % polar NRZ
txs_NRZi = s1NRZi; % NRZi
txs_bip = s1bip; % bipolar
txs_man = s1man; % manchester / split phase
elseif(data(1) == 0) %for bit '0'
txs_uNRZ = s2uNRZ; % unipolar NRZ
txs_pNRZ = s2pNRZ; % polar NRZ
txs_NRZi = s1NRZi; % NRZi------------(exception)
txs_bip = s2bip; % bipolar
txs_man = s2man; % manchester / split phase
end

% repeating for remaining data bits


for i=2:length(data)
if(data(i) == 1) %for bit '1'
txs_uNRZ = [txs_uNRZ, s1uNRZ];
txs_pNRZ = [txs_pNRZ, s1pNRZ];
s1NRZi = -s1NRZi; % inverted
txs_NRZi = [txs_NRZi, s1NRZi];
s1bip = -s1bip; % inverted
txs_bip = [txs_bip, s1bip];
txs_man = [txs_man, s1man];
elseif(data(i) == 0) %for bit '0'
txs_uNRZ = [txs_uNRZ, s2uNRZ];
txs_pNRZ = [txs_pNRZ, s2pNRZ];
txs_NRZi = [txs_NRZi, s1NRZi]; % NRZi-----(exception)
txs_bip = [txs_bip, s2bip];
txs_man = [txs_man, s2man];
end
end

figure;
subplot(5,1,1)
plot(txs_uNRZ); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('txs_uNRZ');
title('unipolar NRZ')
subplot(5,1,2)
plot(txs_pNRZ); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('txs_pNRZ');
title('polar NRZ')
subplot(5,1,3)
plot(txs_NRZi); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('txs_NRZi');
title('NRZi (NRZ inverted - differential encoding)')

DOE,SOE Page | 37
COMMUNICATION LAB

subplot(5,1,4)
plot(txs_bip); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('txs_bip');
title('bipolar / AMI (alternate mark inversion)')
subplot(5,1,5)
plot(txs_man); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('txs_man');
title('manchester / split phase')

Output Waveforms:

Result: Successfully created and plotted the different line codes for the given message input
signal.

DOE,SOE Page | 38
COMMUNICATION LAB

EXP NO 9 Baseband to Passband Conversion


Aim:
To implement baseband to passband conversion and obtain ASK, PSK and FSK signals
Theory:

baseband x carrier = passband

DOE,SOE Page | 39
COMMUNICATION LAB

expected waveform

Program Code:

clc; clear all; close all;


%-------------------------------------------------------------
% 07-02-2022 COMMUNICATION LAB
% Line Codes - Baseband Transmission
%-------------------------------------------------------------
data=[1,0,1,1,0,1,0,0]; % message digital data
Tb = 1; % bit duration
t=0.01:0.01:Tb;
Eb = 1;

DOE,SOE Page | 40
COMMUNICATION LAB

% unipolar NRZ
s1uNRZ = Eb*ones(1,length(t)); % signal s1(t)
s2uNRZ = Eb*zeros(1,length(t)); % signal s2(t)

% polar NRZ
s1pNRZ = Eb*ones(1,length(t)); % signal s1(t)
s2pNRZ = -Eb*ones(1,length(t)); % signal s2(t)

% symbol to signal mapping


if(data(1) == 1) %for bit '1'
txs_uNRZ = s1uNRZ; % unipolar NRZ
txs_pNRZ = s1pNRZ % polar NRZ

elseif(data(1) == 0) %for bit '0'


txs_uNRZ = s2uNRZ;
txs_pNRZ = s2uNRZ
% unipolar NRZ
% polar NRZ
end
% repeating for remaining data bits
for i=2:length(data)
if(data(i) == 1) %for bit '1'
txs_uNRZ = [txs_uNRZ, s1uNRZ];
txs_pNRZ = [txs_pNRZ, s1pNRZ];

elseif(data(i) == 0) %for bit '0'


txs_uNRZ = [txs_uNRZ, s2uNRZ];
txs_pNRZ = [txs_pNRZ, s2pNRZ];

end
end
fc=10;

DOE,SOE Page | 41
COMMUNICATION LAB

fc1=2;
fc2=4;
tc=0.01:0.01:length(data)*Tb % frequency of carrier in Hz
carrier=cos(2*pi*fc*tc);
carrier1=cos(2*pi*fc1*tc);
carrier2=cos(2*pi*fc2*tc);
figure;
subplot(8,1,1)
plot(carrier); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('carrier');
title('carrier')
subplot(8,1,2)
plot(txs_uNRZ); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('txs_uNRZ');
title('unipolar NRZ')
subplot(8,1,3)
plot(txs_pNRZ); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('txs_pNRZ');
title('polar NRZ')
psk_sig = txs_pNRZ .* carrier; % baseband x carrier =
passband
ask_sig = txs_uNRZ .* carrier; % baseband x carrier =
passband
txs_invuNRZ = ~txs_uNRZ;
inv_sig = txs_invuNRZ .* carrier2;
new_sig = txs_uNRZ .* carrier1;
fsk_sig = new_sig + inv_sig;
subplot(8,1,4)
plot(psk_sig); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('psk');
title('PSK signal')
subplot(8,1,5)
plot(ask_sig); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('ask');
title('ASK signal')

DOE,SOE Page | 42
COMMUNICATION LAB

subplot(8,1,6)
plot(txs_invuNRZ); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('fsk');
title('inverted signal')
subplot(8,1,7)
plot(inv_sig); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('fsk');
title('inverted band signal')
subplot(8,1,8)
plot(fsk_sig); axis([0,1000,-2,2]); xlabel('time t --->');
ylabel('fsk');
title('FSK signal')

Output Waveforms:

Result: Successfully created and plotted the waveforms of binary PSK, ASK and FSK signals
by using baseband to passband conversion

DOE,SOE Page | 43
COMMUNICATION LAB

EXP NO 10 Matched Filter

10 a Matched Filter for Rectangular Pulse


Aim: To design a circuit for matched filter and analyse the received list for rectangular pulse
and matched filter

Theory:

Program Code:

clc; clear all; close all;


%-------------------------------------------------------------
% 7-july-2021 EC I7L2 COMMUNICATION LABORATORY II
% matched filter
%-------------------------------------------------------------

snr=40; % signal to noise ratio in dB


threshold=50; % lambda
tx_bit=1; % transmitted data bit
t=-1:0.01:2;
phi=[zeros(1,100),ones(1,101),zeros(1,100)]; % rectangular
pulse phi(t)
x=tx_bit*phi; % transmitted signal
figure; plot(t,x);

DOE,SOE Page | 44
COMMUNICATION LAB

title('transmitted signal x(t)'); xlabel('time t-->');


ylabel('amplitude');
rxs = awgn(x,snr) ; %adding AWGN(additive white gaussian
noise)
figure; plot(t,rxs);
title('received signal rxs(t)'); xlabel('time t-->');
ylabel('amplitude rxs(t)');
%--- receiver ----------------------------------------------
h=phi; % h(t) = phi(T – t) impulse_response of matched
filter
y=conv(rxs,h); % matched filter operation
figure; plot(y);
title('output of matched filter'); xlabel('time t-->');
ylabel('amplitude y(t)');
sample = y(300); % sample at time t = Tb (equivalent n=300)
if(sample >threshold) % decision device
rx_bit=1;
else
rx_bit=0;
end
disp('transmitted bit : '); disp(tx_bit);
disp('detected bit : '); disp(rx_bit);

Output Waveforms

DOE,SOE Page | 45
COMMUNICATION LAB

10b Matched Filter - BER vs SNR

Aim : To plot the graph between BER and SNR and analyse the performance of matched filter

Theory:
BER stands for bit error rate , it is the percentage of bits that have errors relative to the total
number of bits received in a transmitter. it is usually expressed as ten to a negative power. A
high SNR is required for a low BER.

DOE,SOE Page | 46
COMMUNICATION LAB

Program Code:
clc;clear all;close all;
%-------------------------------------------------------------
------------
% Matched Filter (b)
%-------------------------------------------------------------
------------
snr=-20:8; %signal to noise ratio in dB
threshold=50; %lambda
t=1:0.01:2;

phi=[zeros(1,100),ones(1,101),zeros(1,100)]; %rectangular pulse


phi(t)
ber=zeros(1,length(snr));

for i=1:length(snr)
no_errors=0;
for j=1:1000;
txt_bit=round(rand);
x=txt_bit*phi % transmitted signal
rxs=awgn(x,snr(i)); % adding awgn

%--------receiver----------------

h=phi;

DOE,SOE Page | 47
COMMUNICATION LAB

y=conv(rxs,h); %matched filter operation


sample=y(300);
% sample at time t=Tb(equivalent n=300)

if (sample>threshold) % decision device


rx_bit=1;
else
rx_bit=0;
end
if(txt_bit~=rx_bit)
no_errors=no_errors+1;
end
end
ber(i)=no_errors/1000;
end
figure;
semilogy(snr,ber);
Output waveform

DOE,SOE Page | 48
COMMUNICATION LAB

Result:
a. Designed a circuit for matched filter and plotted the corresponding waveforms
b. For a threshold value of 50, a graph is plotted between BER and SNR

DOE,SOE Page | 49
COMMUNICATION LAB

EXP NO 11 Channel Coding (Error detection & correction)

Aim: To determine the codeword from message data and generator matrix and detect and
correct the error received codeword using syndrome.
Theory
Channel Coding - The incoming digital message (information bits) are encoded to produce
the channel codeword. The channel codewords include the information bits, possibly in a
modified form, plus additional bits that are used for error correction. The channel bits are
modulated and transmitted over the channel.

The extra bits are redundant; that is, they carry no new information. However, the receiver uses
these bits to determine when an error occurs and correct a certain number of errors.
Advantage – increased reliability and reduced error rate.
Trade-off - For a fixed modulation scheme, the addition of redundancy in the coded messages
implies the need for increased transmission bandwidth. Moreover, the use of error-control
coding adds complexity to the system.
11a HAMMING CODE
Linear Block Codes (LBC

DOE,SOE Page | 50
COMMUNICATION LAB

Hamming Codes
These comprise a class of codes with the property that

Attributes of Hamming Codes

DOE,SOE Page | 51
COMMUNICATION LAB

Digital Circuit Implementation

MATLAB Functions
 I = eye(n) returns an n-by-n identity matrix with ones on the main diagonal and zeros
elsewhere.
 r = rem(a,b) returns the remainder after division of a by b, where a is the dividend and
b is the divisor. (for modulo 2 arithmetic b=2)
 H(:,i) denotes i’th column of H
 zeros(p,q) returns a p-by-q matrix of all zero elements.

MATLAB Program

clc; clear all; close all;


%--------------------------------------------------
% 21-april-2021 EC I7L2 COMMUNICATION LABORATORY II
% HAMMING CODE - error detection and correction
% linear block code LBC (N,K)=(7,4) = hamming code
% capital letters used for matrices and small letters for vectors
%--------------------------------------------------

% TRANSMITTER-------------------------------------------------
-
a=3;
n=(2^a)-1; %criteria for LBC to be hamming,
n=7

DOE,SOE Page | 52
COMMUNICATION LAB

k=(2^a)-1-a; %criteria for LBC to be hamming,


k=4
m = (n - k); %number of parity check digits
P=[1,1,0;0,1,1;1,1,1;1,0,1]; %parity matrix,size- (k,m = (n -
k))
G=[eye(k),P]; %generator matrix, size- (K,n)
d=[1,1,1,0]; %message vector, size- K
disp('transmitted codeword : ');
c=rem(d*G,2) %transmitted vector, size-n

% RECEIVER --------------------------------------------------
disp('received codeword : ')
%case for one bit error in received codeword
r=[1,1,1,0,1,1,0] %received vector, size-n
H=[transpose(P),eye(m)]; %parity check matrix, size-(m,n)
s=rem(r*transpose(H),2); %syndrome, size-(1,m)
e=zeros(1,n); %error pattern, size-(1,n)
for i=1:n
if(H(:,i)==transpose(s)) %comparing i'th column of H with
syndrome
disp('error position is at : ')
disp(i);
e(1,i)=1
break
end
end
c2=rem((r+e),2); %error correction-
%Modulo 2 addition OF received codeword with error pattern
disp('corrected code word is : ');
disp(c2);

Output:.
transmitted codeword:
c=

1 1 1 0 0 1 0

received codeword:
r=

1 1 1 0 1 1 0

error position is at:


5

DOE,SOE Page | 53
COMMUNICATION LAB

e=

0 0 0 0 1 0 0

corrected code word is:


1 1 1 0 0 1 0

Result: Calculated the codeword using message and parity matrix and corrected the one bit
error using syndrome

DOE,SOE Page | 54

You might also like