0% found this document useful (0 votes)
27 views26 pages

Lab Manual Digital Communication

Uploaded by

vaderd659
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)
27 views26 pages

Lab Manual Digital Communication

Uploaded by

vaderd659
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/ 26

ECL 332

DEPARTMENT OF ELECTRONICS &


COMMUNICATION ENGINEERING

COMMUNICATION
LAB MANUAL

For Sixth Semester B.Tech Degree Courses 2019 scheme


As per APJ Abdul Kalam Technological University
Syllabus

Jenny Patrick
Assistant Professor
Dept of ECE, CEP

[Type text] Page 1


ECL 332

PART B
Experiment No:4
PULSE SHAPING AND MATCHED FILTERING

AIM:

1. Generate a string of message bits.


2. Use root rasied cosine pulse p(t) as the shapig pulse, and generate the corresponding
baseband signal witha fixed bit duration Tb. You may use roll-off factor as α = 0.4.
3. Simulate transmission of baseband signal via an AWGN channel
4. Apply matched filter with frequency response Pr(f ) = P ∗(f ) to the received signal.
5. Sample the signal at mTb and compare it against the message sequence.

THEORY:

In communication systems, data is transmitted as binary bits (ones and zeros). It is easier to
implement a binary system using switches, where turning on a switch represents ‘1’ and
turning it off represents ‘0’. Such simple binary systems essentially represent ones and zeros
as rectangular pulses of finite duration (say τ seconds). A rectangular pulse of finite duration
τ manifests itself as an infinitely extending sinc pulse in the frequency domain (see figure
below). This implies that a rectangular pulse requires infinite bandwidth if it is not to be
distorted during its transmission. Due to the dual nature of Fourier Transform, the following
figure is valid if we alternate the frequency and time domain representations. That is, a
symbol with finite bandwidth will extend infinitely in time. This implies that to send a single
‘1’ or ‘0’ or a series of them (for a multi-level signaling), you would need infinite time
duration. This is absolutely impractical. In practical terms, signals will not extend infinitely
forward and backward in time. But it will definitely be non-zero after the time duration τ.
This implies that the residues of adjacent symbols/signals overlap with each other giving rise
to Inter Symbol Interference (ISI). If the residual energy from the adjacent symbol is very
strong, it becomes impossible to distinguish the present symbol and there is a possibility of it
being misinterpreted altogether. To avoid or reduce this effect, “Pulse Shaping” techniques
are used to make sure that the data carried by the symbols are not affected by the overlapping

[Type text] Page 2


ECL 332

effect of adjacent symbols

Root raised-cosine pulse (RRC): The total effective filter of the transmission system
is the combination of transmit and receive filter , where ∗ is
convolution. This effective filter (and not the individual filters) must fulfil the
Nyquist criterion. We can achieve this goal if both filters have a transfer function
that is equal to the square root of that of the raised cosine filter.
Such a filter is therefore called a root raised cosine (RRC). The combination of both RRC
filters then becomes a raised cosine and thus fulfils the Nyquist criterion. Furthermore,
since the filters are real-valued and symmetric, the RRC is its own matched filter. The
impulse response ofthe RRC filter is given as

Matched Filtering
The receiver’s RF front-end receives analog pulse trains. The information bits need to be
recovered from these pulse trains. This is accomplished in two steps: (i) Mapping from
analog pulse trains to constellation points. (ii) Mapping from complex symbols to bits,
which is Detection.
The received analog signals are matched filtered to create the output complex waveform.
Then thesamples are detected. A representation of this process is shown in Fig.3 below.

[Type text] Page 3


ECL 332

MATLAB CODE

close all;
clear;
rolloff = 0.4;
span = 10;
sps = 7;
M = 16;
k = log2(M);
rctFilt = rcosdesign(rolloff, span, sps,'normal');
fvtool(rctFilt,'Analysis','impulse')
BP_Data = 2*randi([0 1], 50, 1) - 1;
UP_s = upfirdn(BP_Data, rctFilt, sps,1);
EbNo = 100;
snr = EbNo + 10*log10(k) - 10*log10(sps);
filtlen = 10;
rxSignal = awgn(UP_s,snr,'measured');
rxSignal = rxSignal + randn(size(rxSignal))*.01;
rxFiltSignal = upfirdn(rxSignal,rctFilt,1,sps);
rxFiltSignal = rxFiltSignal(filtlen + 1:end - filtlen);
figure;
stem(BP_Data,'filled')
hold on
plot(rxFiltSignal,'r')
xlabel('Time'); ylabel('Amplitude');
legend('Transmitted Data','Received Data')
figure;
plot(rxSignal)
legend('Filtered signal through AWGN')

RESULT: Simulated matched filter using matlab and obtained the samples.

[Type text] Page 4


ECL 332

Experiment No:5
EYE DIAGRAM

AIM
1. Generate a string of message bits.
2. Use rasied cosine pulse p(t) as the shapig pulse, and generate the corresponding
basebandsignal with a fixed bit duration Tb. You may use roll-off factor as α =
0.4.
3. Use various roll off factors and plot the eye diagram in each case for the received
signal. Makea comparison study among them.

THEORY:

In telecommunication, an eye pattern, also known as an eye diagram, is an


oscilloscope display in which a digital signal from a receiver is repetitively sampled and
applied to the vertical input, whilethe data rate is used to trigger the horizontal sweep. It is so
called because, for several types of coding,the pattern looks like a series of eyes between a
pair of rails. It is a tool for the evaluation of the combined effects of channel noise,
dispersion and inter symbol interference on the performance of a baseband pulse-
transmission system.

Eye-diagram feature What it measures

Eye opening (height, peak to peak) Additive noise in the signal

Eye overshoot/undershoot distortion due to interruptions in the signal path

Eye width Timing synchronization & jitter effects

Eye closure Intersymbol interference, additive noise

[Type text] Page 5


ECL 332

MATLAB CODE
close all;
clear;
rolloff = 0.4;
span = 10;
sps = 7;
M = 16;
k = log2(M);
rctFilt = rcosdesign(rolloff, span, sps,'normal');
fvtool(rctFilt,'Analysis','impulse')
BP_Data = 2*randi([0 1], 50, 1) - 1;
UP_s = upfirdn(BP_Data, rctFilt, sps,1)
EbNo = 100;
snr = EbNo + 10*log10(k) - 10*log10(sps);
filtlen = 10;
rxSignal = awgn(UP_s,snr,'measured');
rxSignal = rxSignal + randn(size(rxSignal))*.01;
rxFiltSignal = upfirdn(rxSignal,rctFilt,1,sps);
rxFiltSignal = rxFiltSignal(filtlen + 1:end - filtlen);
figure;
stem(BP_Data,'filled')
hold on
plot(rxFiltSignal,'r')
xlabel('Time'); ylabel('Amplitude');
legend('Transmitted Data','Received Data')
figure;
plot(rxSignal)
legend('Filtered signal through AWGN')
eyediagram(BP_Data,2);legend('Transmitted signal')
eyediagram(rxSignal,2);legend('Recieved signal')
eyediagram(rxFiltSignal,2);legend('Filtered signal')

RESULT:
Eyediagram is obtained.

[Type text] Page 6


ECL 332

EXPERIMENT NO:6
Error Performance of Binary Phase Shift Keying
AIM

1. Generate a string of message bits.


2. Encode using BPSK with energy per bit Eb and represent it using points in a
signal-space.
3. Simulate transmission of the BPSK modulated signal via an AWGN channel with
variance N0/2.
4. Detect using an ML decoder and plot the probability of error as a function of SNR
per bit Eb/N0.
THEORY
Binary Phase Shift Keying
In a coherent binary PSK system, the pair of signals S1(t) and S2 (t) used to represent
binary symbols1 & 0 are defined by
S1 (t) = √2Eb/τb Cos 2πfct
S2 (t) =√2Eb/Tb (2πfct+π) = - √ 2Eb/Tb Cos 2πfct where 0
≤ t< Tb andEb = Transmitted signed energy for bit..
The carrier frequency fc =n/Tb for some fixed integer n.
In BPSK, there is only one basis function of unit energy.
Øb (t) = √2/Tb cos 2fπct 0≤ t< Tb
S1 (t) = √Eb Ø1
(t) 0≤ t ≤TbS2 (t)
= √Eb Ø1 (t) 0≤
t< Tb
The signal space is 1dimensional (N=1) having two message points (M = 2)

Block Diagram of BPSK Transmitter


The input binary symbols are represented in polar form with symbols 1 & 0 represented
by constantamplitude levels √Eb & -√Eb. This binary wave is multiplied by a sinusoidal
carrier in a product modulator. The result in a BSPK signal.

BSPK Receiver:
The received BPSK signal is applied to a correlator which is also supplied with a
locally generated reference signal Ø1 (t). The correlated output is compared with a
threshold of zero volts. If x1> 0, thereceiver decides in favour of symbol 1. If x1< 0, it
decides in favour of symbol 0.

[Type text] Page 7


ECL 332

MATLAB CODE:
clear ;
close all;
num_bit=1e6;
EbNodB=0:1:10;
for i=1:length(EbNodB);
s=2*(round(rand(1,num_bit))-0.5);
w=(1/sqrt(2*10^(EbNodB(i)/10)))*randn(1,num_bit);
r=s+w;
s_est=sign(r);
sim_BER(i)=(num_bit-sum(s==s_est))/num_bit;
end
the_Ber =0.5*erfc(sqrt(10.^(EbNodB/10)));
semilogy(EbNodB, sim_BER,'-');
hold on
semilogy(EbNodB,the_Ber,'ko');
title('Bit error probability curve for BPSK modulation');
legend('Simulation','Theoretical');
xlabel('EbNo(dB)')
ylabel('BER')
grid on

RESULT: Studied and verified the error performance of BPSK

EXPERIMENT NO:7

ERROR PERFORMANCE OF QPSK

AIM
1. Generate a string of message bits.
2. Encode using QPSK with energy per symbol Es and represent it using points in a
signal-space.
3. Simulate transmission of the QPSK modulated signal via an AWGN
channel with variance N0/2in both I-channel and Q-channel.
Detect using an ML decoder and plot the probability of error as a function of SNR per bit
Eb/N0where Es = 2Eb
THEORY
Quadrature Phase Shift Keying
Phase of the carrier takes on one of four equally spaced values such
as π/4, 3π/4,5π/4,7π/4.
Si(t) = √2E/ Tb cos {2 πƒct + (2i – 1)
π/4} , 0≤ t ≤ Tb0 , elsewhere
Where i = 1,2,3,4, & E= Tx signal energy
[Type text] Page 8
ECL 332

per symbolTb = symbol duration


Each of the possible value of phase corresponds to a pair of bits
called dibits.Thus the gray encoded set of dibits: 10,00,01,11
Si (t) = √2E/ Tb cos [(2i – 1)π/4] cos (2πfct) - √2E/ Tb sin
[(2i –1) π/4)]sin (2πfct) ,0≤ t ≤Tb 0 , else where
There are two orthonormal
basis functions
Ø1 (t) = √2/ Tb cos 2πƒct,
0≤ t≤Tb
Ø2 (t) = √2/ Tb sin 2πƒct, 0≤ t ≤Tb
There are four message points

QPSK Transmitter

The i/p binary sequence b(t) is represented in polar from with symbols 1 & 0 represented as
+√E/2and -√E/2 .This binary wave is demultiplexed into two separate binary waves
consisting of odd & even numbered I/P bits denoted by b1(t) & b2 (t). b1 (t) & b2(t) are used
to modulate a pair of quadrature carrier or orthogonal Basis function Ø1 (t) & Ø2 (t). The
result is two PSK waves’ .Thesetwo binary PSK waves are added to produce the desired
QPSK signal .
QPSK Receiver
QPSK receiver consists of a pair of correlators with common I/P & supplied with
Locally generated Signal Ø1 (t) & Ø2 (t). The correlator O/P, x1, & x2 are each
compared with a threshold of zero volts.If x1 > 0, decision is made in favour of symbol
‘1’ for upper channel and if x1 > 0, decision ismade in favour of symbol 0. Parallelly Y
[Type text] Page 9
ECL 332

x2 >0, decision is made in favour of symbol 1 for lower channel & if x2 <0, decision is
made in favour of symbol 0. These two channels are combined in a multiplexer to get
the original binary output.
MATLAB CODE:
clear ;
close all;
num_bit=1e6;
EbNodB=0:1:10;
EbNo=10.^(EbNodB/10);
for n=1:length(EbNodB)
si=2*(round(rand(1,num_bit))-0.5);
sq=2*(round(rand(1,num_bit))-0.5);
s=si+1j*sq;
w=(1/sqrt(2*EbNo(n)))*(randn(1,num_bit)+1j*randn(1,num_bit)
);
r=s+w;
si_=sign(real(r));
sq_=sign(imag(r));
ber1=(num_bit-sum(si==si_))/num_bit;
ber2=(num_bit-sum(sq==sq_))/num_bit;
sim_BER(n)=mean([ber1 ber2]);
end
the_Ber = 0.5*erfc(sqrt(10.^(EbNodB/10)));
semilogy(EbNodB, sim_BER,'-');
hold on
semilogy(EbNodB,the_Ber,'ko');
title('BER curve for QPSK modulation');
legend('Simulation','Theoretical');
xlabel('EbNo(dB)')
ylabel('BER')
grid on

RESULT :
Studied and verified the error performance of QPSK

[Type text] Page 10


ECL 332

EXPERIMENT:8
Performance of Waveform Coding Using PCM
AIM

1. Generate a sinusoidal waveform with a DC offset so that it takes only positive


amplitude value.
2. Sample and quantize the signal using an uniform quantizer with number of
representation levels
L. Vary L. Represent each value using decimal to binary encoder.
3. Compute the signal-to-noise ratio in dB.
4. Plot the SNR versus number of bits per symbol. Observe that the SNR increases
linearly.

THEORY
In Pulse code modulation (PCM) only certain discrete values are allowed for the
modulating signals. The modulating signal is sampled, as in other forms of pulse
modulation. But any sample falling within a specified range of values is assigned a
discrete value. Each value is assigned a pattern of pulses and the signal transmitted by
means of this code. The electronic circuit that produces the coded pulse train from the
modulating waveform is termed a coder or encoder. A suitable decoder must be used at
the receiver in order to extract the original information from the transmitted pulse train.

[Type text] Page 11


ECL 332

MATLABCODE
clear;
clear;
close all;
time = 0:.0005:.05;
freq_msg=100;
dc_ofst=2;
signal=sin(2*pi*freq_msg*time)+dc_ofst;
figure;plot(time,signal)
xlabel('time')
ylabel('Amplitude')
title('Signal')

freq_sample=15*freq_msg;
samp_time=0:1/freq_sample:0.05;
samp_signal=dc_ofst+sin(2*pi*freq_msg*samp_time);
hold on
plot(samp_time,samp_signal,'rx')
title('Sampled Signal')
legend('Original signal','Sampled signal');
L=8;
smin=round(min(signal));
smax=round(max(signal));
Quant_levl=linspace(smin,smax,L);
codebook = linspace(0,smax,L+1);
[index,quants] = quantiz(samp_signal,Quant_levl,codebook);
figure;plot(samp_time,samp_signal,'x',samp_time,quants,'.-')
title('Quantized Signal')
legend('Original signal','Quantized signal');

[Type text] Page 12


ECL 332

figure;plot(samp_time,index,'.-')
title('Encoded Signal')
for i=1:length(index)
bincode_sig{i}=dec2bin(round(index(i)),7);
end
disp('binary encoded signal')
disp(bincode_sig')
noise=quants-samp_signal;
figure;
subplot(1,2,1)
plot(samp_time,noise,'.-')
title('Noise')
r=snr(index,noise);
snr1=['SNR:',num2str(r)];
disp(snr1)
function [ r ] =Quant_Level( l )
time = 0:.0005:.05;
freq_msg=100;
dc_ofst=2;
signal=sin(2*pi*freq_msg*time)+dc_ofst;
freq_sample=15*freq_msg;
samp_time=0:1/freq_sample:0.05;
samp_signal=dc_ofst+sin(2*pi*freq_msg*samp_time);
L=l;
smin=round(min(signal));
smax=round(max(signal));
Quant_levl=linspace(smin,smax,L);
codebook = linspace(0.7,smax,L+1);
[index,quants] = quantiz(samp_signal,Quant_levl,codebook);
for i=1:length(quants)
bincode_sig{i}=dec2bin(round(quants(i)),3);
end
noise=quants-samp_signal;
r=snr(index,noise);
end
l=[8,16,32,64,128];
for i=1:length(l)
r(i) = Quant_Level(l(i));
end
subplot(1,2,2)
plot(l,r)
xlabel('L')
ylabel('snr')
title('L vs SNR')

RESULT
Performance of PCM is evaluated and calculated the SNR.Also SNR plot is obtained.

[Type text] Page 13


ECL 332

PART C

EXPERIMENTNO:9

FAMILIARIZATION WITH SOFTWARE DEFINED RADIO


(HARDWARE AND CONTROL SOFTWARE

AIM:
1.To Familiarize with an SDR hardware for reception and transmission of RFsignal.
2.To Familiarize how it can be interfaced with computer.
3.To Familiarize with GNU Radio (or similar software’s like Simulink/ Lab-View) that can
be used to process the signals received through the SDRhardware.
4.To Familiarize available blocks in GNU Radio. Study how signals can begenerated and
spectrum (or power spectral density) of signals can beanalyzed. Study how filtering can be
performed.

THEORY:
Hardware Required
• RTL SDR dongle
• Hack RF one ( if you want to transmit)
• FM Transmitter or some other RF signal source. (Be careful) ( Raspberry pi can be used )
• A PC or a Raspberry Pi

[Type text] Page 14


ECL 332

• Chinese clones for original hack rf one are available online at about Rs 8.5 k
• Another possibility is Adalam Pluto board from Analog devices
Software Required

It is advised to do all the experiments on ubuntu 20.04 LTS


• Gqrx
• Gnu Radio
• Cubic SDR ( if you want to transmit)
• There are plenty of other software available

[Type text] Page 15


ECL 332

[Type text] Page 16


ECL 332

[Type text] Page 17


ECL 332

[Type text] Page 18


ECL 332

[Type text] Page 19


ECL 332

RTL SDR DONGLE CONNECTION DIAGRAM

[Type text] Page 20


ECL 332

[Type text] Page 21


ECL 332

[Type text] Page 22


ECL 332

[Type text] Page 23


24
25
ECL 332

You might also like