Lab Manual Digital Communication
Lab Manual Digital Communication
Experiment List
Sr. No. Name of Experiment Page No.
1. To generate uniform and normal random variables, also find the mean 2-5
and variance of the distribution.
10. (a). To analyze the Delta Modulation and Demodulation using 60-64
Multisim
1
EXPERIMENT NO. –1
AIM: -
a. To generate uniform random variables, also find mean and variance of the distribution.
b. To generate normal random variables, also find mean and variance of the distribution.
SOFTWARE USED: -
MATLAB R2016a
FUNCTIONS USED: -
THEORY: -
a. Uniform random number generation is being carried out with the help of “rand”
function.
b. The probabilitydensity function of variables should be uniform over the range of [0,1].
2
Mean is the average value of numbers generated, symbolized as ‘µ’ can be calculated from data as ∑ =1 and
∑
=1
+
can be narrowed to ; where a,b are the distribution ranges for unifrom probability density function.
2
Theoretically mean of the random numbers should be 0.5, accuracy of which depends on the number of samples
generated.
Variance is an aspect which measures the deviation of random variables from its mean value. For a uniform
2
random function ranges from [a,b] variance can be calculated by ( − )
12 . Theoretically variance of uniform
random numbers distributed in [0,1] as calculated from the given formula equals to 0.83.
a) Generation of random numbers having normal(gaussian) probability density function is being carried out
with the help of “randn” function. The probability density function of variables ranges in (-∞, ∞) defined by
1 −( − )2
( ) =
√2 2 2 .
Mean ‘µ’ for standard normal distribution function should be zero while the variance ‘σ2’ should be one.
3
MATLAB CODE: -
clc
clear allclose
all
a = rand (1,5500);b =
mean (a);
c = var (a);
disp (b);
disp (c); figure (1);
subplot(211);plot
(a);
title ('Uniform Distribution of Random Variables');xlabel ('Sample Number')
ylabel ('Amplitude')
subplot(212); hist(a);
title ('Histogram of Uniform Distribution');xlabel ('Numerical
Value');
ylabel ('Total no. of Occurence');
clc
clear allclose
all
OUTPUT: -
4
Figure 1(a)
Figure 1(b)
CONCLUSIONS: -
5
EXPERIMENT 2.
AIM: -
SOFTWARE USED: -
Matlab R2016a
FUNCTIONS USED: -
sin(2*pi*f*t): - It generates sine waveform with time period 1/f.
square(t): - It generates square waveform with time period 2π for the elements of
time vector t.
sawtooth(t): - It generates sawtooth waveform with time period 2π for the
elements of time vector t.
stem(_,_): - It provides graphical representation of data in discrete manner.
axis([a b c d]): - It sets the limit for current axes. The four element vector
a,b,c,d specifies minimum and maximum for x and y axis respectively.
plot (a,b): - For graphical representation of data with ‘a’ belonging to x axis and
‘b’ belonging to y axis.
subplot (l,m,n): - Used for compiling more than one plot where l,m,n
represents total number of rows, columns and figure position for the
divided grid.
THEORY:-
The sine function generates sine wave with a period of 1/f where ‘f’ is specified
frequency.
The sawtooth function generates a sawtooth wave with peaks at +/- ‘A’ and a period
of 2π . An optional width parameter specifies a fractional multiple of 2π at which the
signal's maximum occurs.
The square function generates a square wave with a period of 2π . An optional
parameter specifies duty cycle, thepercent of the period for which the signal is positive.
6
Waveforms generated can be amplified or attenuated by multiplying the function by
a scalar element. Timescaling is a technique that alters the time period of the signal
thus expanding or contracting the same.
MATLAB CODE: -
a) To generate continuous waveforms
clc clear all
close all
t = 0:0.01:10
f = 3;
a = 3*sin(2*pi*f*t);
b = 5*square(3*t);
c = 4*sawtooth(3*t);
figure(1);
subplot(311);
plot(t,a);
title ('Sine waveform');
xlabel ('Time(continuous)');
ylabel ('Amplitude')
axis ([0 3 -6 6]);
subplot(312);
plot(t,b);
axis ([0 8 -7 7]);
title ('Square waveform');
xlabel ('Time(continuous)')
ylabel ('Amplitude')
subplot(313);
plot(t,c);
axis ([0 8 -5 5]);
title ('Sawtooth waveform');
xlabel ('Time(continuous)')
ylabel ('Amplitude')
OUTPUT: - a) Generated continuous sine, square and sawtooth waveforms. Figure 2(a) b)
Generated discrete sine, square and sawtooth waveforms. Figure 2(b
OUTPUT: -
Figure 2(a)
Figure 2(b)
8
CONCLUSIONS: -
a. The process of time scaling and amplification is applied and observed
along with the frequency change in the generated signals.
b. The interval distribution for the continuous signal generation
should be low to obtain optimum waveforms.
c. The time spacing for discrete signal generation should be
observed for the functional values to be differentiable.
EXPERIMENT NO.-3
Theory:
Pseudo-Noise (PN) sequences are commonly used to generate noise that is approximately "white". It has
applications in scrambling, cryptography, and spread-spectrum communications. It is also commonly referred
to as the Pseudo-Random Binary Sequence (PRBS). These are very widely used in communication standards
these days. The qualifier "pseudo" implies that the sequence is not truly random. Actually, it is periodic with a
(possibly large) period, and exhibits some characteristics of a random white sequence within that period.
Pseudo random noise generator built from Linear Feedback ShiftRegister (LFSR) with judicious selection of
the XOR taps feedback path. Pseudo random number generators generate a stream of numbers in a known
pattern. The pattern is typically very long and it is hard to recognize the sequence of numbers is ordered.
LFSR is a linear feedback shift register whose input bit is a linear function of previous function that contains
9
the signal through the register from one bit to the next most significant when it is clocked. Figure 1 shows the
block diagram of LFSR, a 4-bit LFSR generate 24-1 different non zero bit pattern by performing exclusive-OR
gate on the outputs of two or more of the flip-flops and feeding those outputs back in to the input of one of
the flip-flops.
expedited : to make something happen more quickly
Clock recovery from the data stream is expedited by modifying the transmitted data. Wherever a serial
communication channel does not transmit the clock signal along with the data stream, the clock must be
regenerated at the receiver, using the timing information from the data stream. Clock recovery is a common
component of systems communicating over wires, optical fibers, or by radio.
10
Procedures:
11
Figure 3: Interfacing IC 74123 with pn sequence generator
12
Figure 5: Comparator Circuit
Observation Table:
Table I
clock QA QB QC QD Output
1. 0 1 0 0
2. ….. ….. ….. …..
3. ….. ….. ….. …..
4. ….. ….. ….. …..
5. ….. ….. ….. …..
… ….. ….. ….. …..
… ….. ….. ….. …..
… ….. ….. ….. …..
… ….. ….. ….. …..
… ….. ….. ….. …..
… ….. ….. ….. …..
13
… ….. ….. ….. …..
… ….. ….. ….. …..
… ….. ….. ….. …..
Table II
n Primitive Polynomial
1 1+x
2 1+x+x2
3 1+x+x3 , 1+x2+x3
4 1+x+x4, 1+x3+x4
14
Results:
Figure 7: Rising and falling edge pulses with respect to input clock.
15
Figure 8: Output of BPF and recovered clock.
EXPERIMENT 4
Apparatus and Component Required: IC 7474, IC 7486, IC 741, Resistors and capacitor, function
generator, and connecting wires
Theory:
The pulse code modulator technique samples the input signal x(t) at a sampling frequency. This
sampled variable amplitude pulse is then digitalized by the analog to digital converter. Figure (1)
shows the PCM generator.
16
Figure.(1): PCM modulator
In the PCM generator, the signal is first passed through sampler which is
sampled at a rate of (fs) where:
The output of the sampler x(nTs) which is discrete in time is fed to a q level quantizer. The quantizer
compares the input x(nTs) with it's fixed levels. It assigns any one of the digital level to x(nTs) that
results in minimum distortion or error. The error is called quantization error, thus the output of the
quantizer is a digital level called q(nTs). The quantized signal level q(nTs) is binary encode. The
encoder converts the input signal to v digits binary word.
18
Figure (4): The reconstructed signal
Procedure:
19
Sampler
20
21
22
Result:
Precaution:
EXPERIMENT – 05
AIM: Study of PULSE CODE MODULATION (PCM) and its DEMODULATION Scheme
through SIMULINK Models on MATLAB.
COMPONENTS REQUIRED:
24
BLOCK(s) used in PCM scheme:
25
SAMPLE and HOLD: The Sample and Hold block acquires the input at the
signal port whenever it receives a trigger event at the trigger port (marked by
). The block then holds the output at the acquired input value until the next
triggering event occurs.
26
UNIFORM ENCODER: The Uniform Encoder block performs the following two
operations on each floating-point sample in the input vector or matrix:
o Quantizes the value using the same precision.
o Encodes the quantized floating-point value to an integer value.
27
INTEGER TO BIT CONVERTER: The Integer to Bit Converter block maps
each integer (or fixed-point value) in the input vector to a group of bits in the
output vector. This block is single-rate and single-channel.
ANALOG FILTER DESIGN: The Analog Filter Design block designs and
implements a Butterworth, Chebyshev type I, Chebyshev type II, elliptic, or
bessel filter in a high pass, low pass, band pass, or band stop configuration. The
Analog Filter Design block uses a state-space filter representation, and applies
the filter using the State-Space (Simulink) block in the Simulink Continuous
library. All of the design methods use Signal Processing Toolbox functions to
design the filter.
SCOPE: The Scope block displays its input with respect to simulation time. The
Scope block can have multiple axes (one per port); all axes have a common time
range with independent y-axes. The Scope allows you to adjust the amount of
time and the range of input values displayed.
29
OBSERVATION:
30
Fig.2 Pulse generator & Uniform Encoder Output
Output of Scope 4
31
Output of Scope 1
Final Output
32
SINE WAVE & ANALOG FILTER DESIGN OUTPUT:
33
RESULT AND DISCUSSION:
o From a setup for PCM block diagram done in MATLAB Simulink
Software, the first input, scope-2 is shown above. The result shows that
the input analog signal is a sine wave pattern and pulse generator.
o Based on the theoretical concept of PCM, it shows that the whole result of
simulation MATLAB SIMULINK has achieved 100% accuracy.
CONCLUSION:
The MATLAB SIMULINK of the PCM block diagram was studied and
executed. We have successfully done a performance analysis of Pulse Code
Modulation and the output has been depicted in the figures above. In this work,
according to the basics of the PCM system, every block is implemented
sequentially in MATLAB SIMULINK. Every function of PCM system is
included in a single block of MATLAB SIMULINK, which is very helpful for
the students to understand the whole PCM system.
34
EXPERIMENT NO: 6
Aim: To study BPSK Modulation and plot BER using MATLAB
Theory:
Digital modulation:
There are three basic types of modulation methods for the transmission of a digital signal. The
methods are based on three attributes of a sinusoidal signal, amplitude, frequency and phase.
The corresponding digital modulation methods are amplitude shift keying (ASK), frequency
shift keying (FSK) and phase shift keying (PSK).
Amplitude shift keying (ASK): Amplitude shift keying (ASK) is the simple form of digital
modulation. Digital input is unipolar NRZ signal. In ASK carrier amplitude is multiplied by
high amplitude for binary “1” or by low amplitude for a binary “0”. However, when the low
amplitude is 0 for binary “0” then the ASK is called On-Off keying or OOK which shown in
Figure 1. In OOK the amplitude modulated carrier signal can be written as
………….(1)
Fig.1
Frequency shift keying (FSK): In frequency shift keying (FSK), the frequency of the carrier is
shifted between two discrete values, one representing binary “1” and representing binary “0”
35
but the carrier amplitude does not changes. The simple form of FSK is BFSK. The
instantaneous vale of the FSK signal is given by
………(2)
Where, 1 and 2 are the frequencies corresponding to binary “1” and “0” respectively and 1
> 2. From above equation, it is clear that the FSK signal can be considered to be comprising
of two ASK signal with carrier frequencies f1 and f2.
Fig.2
Phase shift keying (PSK):
In Phase shift keying (PSK), the phase of the carrier is modulated to represent the binary
values. The carrier phase change between 0 and by the bipolar digital signal. Binary states
“1” and “0” are represented by the positive and negative polarity of the digital signal. The
simplest form of PSK is BPSK is shown in Figure 3. The instantaneous value of the digital
signal can be written as
Where, = ±1; = 1 for binary state “1” and = −1 for binary state “0”.
36
Fig.3
With Binary Phase Shift Keying (BPSK), the binary digits 1 and 0 maybe represented by the
analog levels and respectively. The system model is as shown in the Figure
below.
Channel Model:
The transmitted waveform gets corrupted by noise , typically referred to as Additive White
Gaussian Noise (AWGN).
Additive : As the noise gets ‘added’ (and not multiplied) to the received signal
White : The spectrum of the noise if flat for all frequencies.
Gaussian : The values of the noise follows the Gaussian probability distribution
37
Computing the probability of error
The received signal,
The conditional probability distribution function (PDF) of for the two cases are:
and
.
38
Probability of error given was transmitted
With this threshold, the probability of error given is transmitted is (the area in blue region):
where,
Given that we assumed that and are equally probable i.e. , the bit
error probability is,
Simulation model:
Matlab code for computing the bit error rate with BPSK modulation from theory and
simulation. The code performs the following:
(c) Demodulation of the received symbol based on the location in the constellation.
39
(d) Counting the number of errors.
Result:
40
Fig.5
EXPERIMENT 7
41
42
43
44
45
46
EXPERIMENT- 8
1. AIM : To study the Digital Signal transmission using Quadrature Amplitude Modulation
(QAM) using MATLB Tool
2. Learning Outcome: After the competing this experiment we can learn that
How does change the Amplitude and phase of a higher frequency signal (carrier signal) with
16-symbols baseband binary polar pulse sequence (Digital Message signals) i.e. study of
16-QAM.
47
The effects of the channel Gaussian noise on the modulated signal i.e. study of the SNR of
QAM.
3. Theory:
The Quadrature Amplitude Modulation (QAM) is mainly used to increase the transmission rate and
decrease he transmission bandwidth. This modulation scheme uses in the both analog and digital
version of the communication. Digital signal transmission using QAM has same concept of the
analog version of the QAM .But basic difference in the base band signal, the message signals are
two digital bit streams, (binary polar pulse sequence) instead of the two analog message signals in
this case. These two base band signals are modulated (m1 (t) and m2 (t)) by a carrier of the same
frequency (cos(wct)) but in quadrature phase(sin(wct)). A basic block diagram of QAM Modulator
and demodulator are shown in Fig.1.(a).
(1)
48
Where and
p(t) is properly shaped baseband pulse . The signal pi(t) can be generated using QAM . One
possible choice of ri and Θi for 16 pulses is shown in Fig.1.(b). The transmitting pulse pi(t can take
on 16 distinct forms and is, therefore , a 16-ary pulse. Since M=16, each pulse can transmit the
information on 4 binary digits. This can be done as follows: there are 16 possible sequences of four
binary digits and there are 16 combinations (ai,bi) in Fig.1.(b). Thus, every possible 4-bit sequence
is transmitted by a particular (ai,bi) or (ri , Θi ). Therefore. One signal pulse
transmits 4 bits. The bit rate quadrated without increasing the bandwidth. The transmission rate can
be increased further by increasing the value of M.
After modulation, this modulated signal will be transmitted through a channel which having the
AWGN noise with energy to noise power spectrum density E/N =10 dB.
4. Apparatus and Component required:
MATLAB TOOL
49
Observe the generated binary data stream and compare this with its equivalent integers
signal.
Observe Constellation plots of the modulated 16-QAM with and without AWGN
channel noise, and compare results of the both cases.
Comments on the SNR of the modulated signal at case of the AWGN channel noise.
7. Questions:
What are basic differences between the digital QAM and Analog QAM?
Why it is called the Quadrature PSK (QPSK)?
Write the some advantages of QAM over the other modulation schemes.
How does it increase the transmission rate and increase the bandwidth efficiency with
increase of the bit in symbol of signal?
EXPERIMENT 9
Aim: Generate the line codes for a 10-bit dataset in MATLAB simulation environment.
1. Learning Outcome: After the completing this experiment we becomes familiar to generate
line codes of a binary dataset in digital communication.
2. Theory: A computer network is used for communication of data from one station to another
station in the network. We have seen that analog or digital data traverses through a
communication media in the form of a signal from the source to the destination. The
channel bridging the transmitter and the receiver may be a guided transmission medium
such as a wire or a wave-guide or it can be an unguided atmospheric or space channel. But,
irrespective of the medium, the signal traversing the channel becomes attenuated and
distorted with increasing distance. Hence a process is adopted to match the properties of
the transmitted signal to the channel characteristics so as to efficiently communicate over
the transmission media. There are two alternatives; the data can be either converted to
digital or analog signal. Both the approaches have pros and cons. What to be used depends
on the situation and the available bandwidth.
Now, either form of data can be encoded into either form of signal. For digital signaling,
the data source can be either analog or digital, which is encoded into digital signal, using
50
different encoding techniques. The basis of analog signaling is a constant frequency signal
known as a carrier signal, which is chosen to be compatible with the transmission media
being used, so that it can traverse a long distance with minimum of attenuation and distortion.
Data can be transmitted using these carrier signals by a process called modulation, where one
or more fundamental parameters of the carrier wave, i.e. amplitude, frequency and phase are
being modulated by the source data. The resulting signal, called modulated signal traverses
the media, which is demodulated at the receiving end and the original signal is extracted. A
line code is a specific code (with precisely defined parameters) used for transmitting a digital
signal over a channel. Line coding is used in digital data transport –the pattern of voltage,
current used to represent digital data on a transmission link is called line encoding.
51
Important parameters those characteristics line coding techniques are mentioned below.
No of signal levels: This refers to the number values allowed in a signal, known as signal levels, to
represent data. Figure 2 (a) shows two signal levels, whereas Fig. 2 (b) shows three signal levels to
represent binarydata.
Fig. 2 (a) Signal with two voltage levels, (b) Signal with three voltage levels
Bit rate versus Baud rate: The bit rate represents the number of bits sent per second, whereas
the baud rate defines the number of signal elements per second in the signal. Depending on the
encoding technique used, baud rate may be more than or less than the data rate.
DC components: After line coding, the signal may have zero frequency component in the
spectrum of the signal, which is known as the direct-current (DC) component. DC component in a
signal is not desirable because the DC component does not pass through some components of a
communication system such as a transformer. This leads to distortion of the signal and may create
error at the output. The DC component also results in unwanted energy loss on the line.
Signal Spectrum: Different encoding of data leads to different spectrum of the signal. It is
necessary to use suitable encoding technique to match with the medium so that the signal suffers
minimum attenuation and distortion as it is transmitted through a medium.
Synchronization: To interpret the received signal correctly, the bit interval of the receiver should be
exactly same or within certain limit of that of the transmitter. Any mismatch between the two may
lead wrong interpretation of the received signal. Usually, clock is generated and synchronized from
the received signal with the help of a special hardware known as Phase Lock Loop (PLL).
However, this can be achieved if the received signal is self-synchronizing having frequent
transitions (preferably, a minimum of one transition per bit interval) in the signal.
Cost of Implementation: It is desirable to keep the encoding technique simple enough such that it
does not incur high cost of implementation.
4. Line Coding Techniques: Line coding techniques can be broadly divided into three broad
categories: Unipolar, Polar and Bipolar as shown in fig. 3.
52
Fig. 3 Three basic categories of line coding techniques
4.1 Unipolar: In unipolar encoding technique, only two voltage levels are used. It uses only one
polarity of voltage level as shown in Fig. 4. In this encoding approach, the bit rate same as data
rate. Unfortunately, DC component present in the encoded signal and there is loss of
synchronization for long sequences of 0’sand 1’s. It is simple but obsolete.
waveform has ‘A’ volts when ‘1’ is transmitted. In RZ form, the ‘A’ volts is presented for ,
2
period if symbol ‘1’ transmitted and remaining , waveform returns to zero value, i.e., for
2
unipolar RZ form.
If symbol ‘1’ is transmitted, then we have
0 ≤ < /2
( )={ 0 ≤ < (1)
2
If symbol ‘0’ is transmitted, then
( )=0 0≤ < (2)
If the input bit pattern is 1101000011, then the unipolar RZ waveform will be
53
Fig. 5 Unipolar RZ
ii) Unipolar NRZ (ON-OFF keying): In unipolar NRZ format, when symbol ‘1’ is to be transmitted,
the symbol has ‘A’ volts for full duration. When symbol ‘0’ is to be transmitted, thesignal has zero
volts for complete symbol duration.
If symbol ‘1’ is transmitted
( )= 0≤ < (3)
If symbol ‘0’ is transmitted
2
If ‘0’ is transmitted, then
/2 0≤ < /2
( )={ (6)
0 ≤ <
2
Fig. 7 Polar RZ
ii) Polar Non Return to zero (NRZ): The most common and easiest way to transmit digital
signals is to use two different voltage levels for the two binary digits. Usually a negative voltage
is used to represent one binary value and a positive voltage to represent the other. The data is
encoded as the presence or absence of a signal transition at the beginning of the bit time. As
shown in the figure below, in NRZ encoding, the signal level remains same throughout the bit-
period. There are two encoding schemes in NRZ: NRZ-L and NRZ-I.
ii) a) NRZ-L: For polar NRZ format, symbol ‘1’ is represented by negative polarity and symbol ‘0’ is
represented by positive polarity.
If symbol ‘1’ is transmitted, then
( ) = /2 0≤ < (7)
If symbol ‘0’ is transmitted, then
55
( )= /2 0≤ < (8)
56
Fig. 8 Polar NRZ-L
b) NRZ-I: For polar NRZ format, symbol ‘0’ is represented by no transition state and symbol‘1’ is
represented by transition state.
If symbol ‘1’ is transmitted, then
57
Fig. 10 Manchester Code
iii) Differential Manchester code: In Differential Manchester, inversion in the middle of each
bit is used for synchronization. The encoding of a ‘0’ is represented by the presence of a
transition both at the beginning and at the middle and ‘1’ is represented by a transition only in
the middle of the bit period.
58
5. Apparatus and Software: Computer with MATLAB software environment.
6. Results and observation: Generate waveforms for line codes.
Take amplitude A=1; Samples/bit (Tb) = 1000; bit width = clock period and
59
Input Bit Pattern: [1 1 0 1 0 0 0 0 1 1]
7. Questions:
i) Why do you need encoding of data before sending over a medium?
ii) What are the four possible encoding techniques? Give examples.
iii) Between RZ and NRZ encoding techniques, which requires higher bandwidth and why?
iv) How does Manchester encoding differ from differential Manchester encoding?
v) How Manchester encoding helps in achieving better synchronization?
vi) Distinguish between PAM and PCM signals?
vii) What is quantization error? How can it be reduced?
EXPERIMENT 10
Aim:- To analyse the Delta modulation and Demodulation using Multisim
Theory
60
61
62
63
64
XFG1
XSC1 XSC2
U1 4 U4A
R2 R12
~1PR G
Ext T rig
10kΩ 100 Ω 2 1D 1Q 5 + T
_
A B C D
D1 R9 A B
20kHz ~1CLR
R11 5V 1
7474N
50kΩ V6
Key=A 100% 5V
C2
V2
0.033uF V4 5V
12 V
R7
R3 4
U3 3.3kΩ
100kΩ U2
R5 R6
2
6 10kΩ 100 Ω
D3
3 5V COMPARATOR_VIRTUAL
R8
5 1 7 741 R4 3.3kΩ
1kΩ
D2
V3 5V
12 V
R17
50kΩ R1
C3 100%
Key=A
10kΩ
1nF
C1
V10 V1
12 V 0.099uF V8 5V
4 U7 12 V R15
2
4
U5 3.3kΩ
U6
6
R19 R18 R13 R14
3 2
159.2kΩ 159.2kΩ 6 6.8kΩ 100 Ω
7 1 5 741 D5 R16
V9 3 5V COMPARATOR_VIRTUAL
R10
12 V 5 1 7 3.3kΩ
741
1kΩ
C4 D4
V7 5V
1nF 12 V
XSC3
Ext T rig
+
_
A B
+ _ + _
65