You are on page 1of 50

DR.

AKHILESH DAS GUPTA INSTITUTE OF


TECHNOLOGY AND MANAGEMENT
(NEW DELHI)

Digital Communication Lab - Practical File


Paper Code: ETEC – 357
Session: June-December 2020

SUBMITTED BY: SUBMITTED TO:


Ashi Saxena Ms. Suman Arora

ROLL NO: 40896202718 ADGITM, Delhi

CSE 5​TH ​SEM , T 17

ADGITM, DELHI

Ashi Saxena 40896202718 CSE – T17


1
DCOMM FILE

INDEX​:
Serial Experiment name date Page
no. no
1 To study CRO 3

2 To study MATLAB software 5

3 Study sampling theorem & reconstruction of signal using kits 9

4 Study sampling theorem & reconstruction of signal using MATLAB 14

5 To study TDM-PAM using kit 16

6 To study TDM-PCM using kit 20

7 To study pulse code modulation using MATLAB 23

8 To study Delta modulation 25

9 To study Adaptive delta modulation 32


10 Generating Rayleigh distribution for different alpha 35

11 Generating Poisson distribution for different alpha 36

12 Generating Gaussian distribution for different alpha 38

13 Perform Line Coding using MATLAB 40

14 To study & implement ASK & OOK Modulation 43

15 To study & implement FSK using MATLAB 46

16 To study & implement PSK using MATLAB 48

Ashi Saxena 40896202718 CSE – T17


2
Experiment 1
Aim​:​ ​To Study CRO​.

Apparatus​:​ ​CRO, Power Supply, Probe, Jumper Wires, Function Generator​.

Theory​: ​The ​CRO stands for a cathode ray oscilloscope​. The cathode ray
oscilloscope is an electronic test instrument; it is used to obtain waveforms
when the different input signals are given. In the early days, it is called as an
Oscillograph. The oscilloscope observes the changes in the electrical signals
over time, thus the voltage and time describe a shape and it is continuously
graphed beside a scale. By seeing the waveform, we can analyze some
properties like amplitude, frequency, rise time, distortion, time interval and etc.
Karl Ferdinand Braun invented it in 1897​.

Working Principle of CRO​: ​It works on the principle of the deflection of the
electron been with the help of deflection plates before it falls over the
phosphorescent screen.

Block Diagram of CRO:

​Buttons of CRO:
1. On/Off​: ​This is required to turn the CRO on or off as per the requirement​.
2. Channel Select​: ​ ​As we know most of the CRO can work simultaneously with
two signals and thus there is a toggle switch present in the controls regarding the
selection, i.e., if both the channels are used or only one is used. So, selection must
be done accordingly. If both the channels are used the selection should be ‘Dual’

Ashi Saxena 40896202718 CSE – T17


3
and if only one channel is used it should be either ‘channel 1’ or ‘channel 2’
depending on the connection​.
3. Trigger Hold-Off:​ ​The trace in a CRO is performed by the sweeping of electrons
for a small period of time on the phosphorous screen by the voltage generated due
to the signal. This voltage is known as sweep voltage. When the ‘sweep’ is
completed the voltage returns to its original value and thus forcing the beam of
electrons to move back. This process is called ‘retrace’, when the retrace is
completed again sweep starts. Hold-Off determines the time that tends to pass
between ‘retrace’ and ‘sweep’. Initially it is set to zero, but to avoid the certain peaks
and noises in the signal the sweep time can be increased to obtain a stable signal at
the display.​
4. AC/DC/GD​: ​This is a toggle switch to tell the CRO about the filtering of the i/p
signal channel. This is present one for each channel.​
● ​AC (Alternating Current Coupling​): ​If the switch is at AC then the
signal will go through a RC-filter to remove its DC components​.
● DC (Direct Current Coupling):​ ​If the​ ​switch is at DC position then the
signal will not go through a RC-filter and the DC components will persist in
the signal.
● GD (Ground):​ ​If the switch is at the GD position then the input signal is
shorted and thus a horizontal line is seen in the display symbolizing no
potential difference between ground and input signal.​
5. Focus:​ ​This rotating knob is used to improve the sharpness of an image of the
signal on the screen by adjusting the focus of the electronic beam. Thus, it helps in
taking the proper measurements and to study the correct shape of the signal by
removing the blurriness of the signal.​
6. Intensity:​ ​This knob is used to increase the intensity of the input signal for better
examination of the displayed output on the screen. There is a common
misconception regarding this knob to be a brightness control feature but it is not so,
this increases the number of electrons in the beam so that more and more electrons
collide the phosphorus screen for better view of the applied input signal. This knob is
marked as ‘Intens’ on the CRO​.
7. +/-​ : ​This determines if the signal is triggered during the positive flank or the
negative flank. Now, the many of you must be wondering ‘what is triggering?’, it is
the synchronization of the horizontal sweep of the CRO with the proper point of the
signal. If the button is on descending slope of the signal is used while triggering
otherwise the ascending slope of the signal is used.​
8. At/Norm.:​ ​Using this button you can select between Automatic triggering (At.) and
manual triggering level selection.​
9. Level:​ ​When the triggering is set to manual mode this wheel is used to set the level
of manual triggering, the +/- button will make sure ascending level triggering or
descending level triggering is used.​
10. Ext.​:​ ​This
button is used when the timing of the CRO is not determined by the
input waveform but from some another external waveform. There is an input
connector beside the button where the external input is connected for the display of
the waveform.​

Result​: ​Hence we studied CRO.

Ashi Saxena 40896202718 CSE – T17


4
Experiment 2

Aim​:​ ​To study MATLAB software

Theory​:
The name MATLAB stands for MATrix LABoratory. MATLAB was written originally to
provide easy access to matrix software developed by the LINPACK (linear system
package)and EISPACK (Eigen system package) projects.
It allows matrix manipulations, plotting of functions and data, implementation of
algorithms, creation of user interfaces, and interfacing with programs written in other
languages. it has sophisticated data structures, contains built-in editing and
debugging tools, and supports object-oriented programming.
It has powerful built-in routines that enable a very wide variety of computations. It
also has easy to use graphics commands that make the visualization of results
immediately available. Specific applications are collected in packages referred to as
toolbox. There are toolboxes for signal processing, symbolic computation, control
theory, simulation, optimization, and several other fields of applied science and
engineering.

Basics Functions in MATLAB:


Operators and Elementary Operations:

1. Arithmetic Operations

+ Addition

- Subtraction

.* Multiplication

* Matrix multiplication

./ Right array division

.\ Left array division

mod Remainder after division (modulo operation)

rem Remainder after division

2. Relational Operations

== Determine equality

>= Determine greater than or equal to

> Determine greater than

<= Determine less than or equal to

< Determine less than

~= Determine inequality

Ashi Saxena 40896202718 CSE – T17


5
3. Logical Operations

& Find logical AND

~ Find logical NOT

|​| Find logical OR

xor Find logical exclusive-OR

false Logical 0 (false)

true Logical 1 (true)

4. Entering Commands
ans Most recent answer

clc Clear Command Window

5. Matrices and Arrays


zeros Create array of all zeros

ones Create array of all ones

rand Uniformly distributed random numbers

true Logical 1 (true)

false Logical 0 (false)

Data Types:
1. Numeric Types

double Double-precision arrays

single Single-precision arrays

cast Convert variable to different data type

typecast Convert data type without changing underlying data

NaN Create array of all NaN values

2. Characters and Strings

string String array

strings Create string array with no characters

join Combine strings

char Character array

newline Create newline character

Ashi Saxena 40896202718 CSE – T17


6
Examples​:
Array Creation
To create an array with four elements in a single row, separate the elements with either a
comma (,) or a space.
a = [1 2 3 4]
a = ​1×4

1 2 3 4
Row vector

To create a matrix that has multiple rows, separate the rows with semicolons.
a = [1 2 3; 4 5 6; 7 8 10]
a = ​3×3

1 2 3
4 5 6
7 8 10

Another way to create a matrix is to use a function, such as ones, zeros, or rand. For
example, create a 5-by-1 column vector of zeros.
z = zeros(5,1)
z = ​5×1

0
0
0
0
0

Matrix and Array Operations


MATLAB allows you to process all of the values in a matrix using a single arithmetic operator or
function.
a + 10
ans = ​3×3

11 12 13
14 15 16
17 18 20

sin(a)
ans = ​3×3

0.8415 0.9093 0.1411


-0.7568 -0.9589 -0.2794
0.6570 0.9894 -0.5440

To transpose a matrix, use a single quote ('):


a'
ans = ​3×3

1 4 7
2 5 8

Ashi Saxena 40896202718 CSE – T17


7
3 6 10

You can perform standard matrix multiplication, which computes the inner products between rows and
columns, using the * operator. For example, confirm that a matrix times its inverse returns the identity
matrix:
p = a*inv(a)
p = ​3×3

1.0000 0 0
0.0000 1.0000 0
0.0000 -0.0000 1.0000

Concatenation
Concatenation​ is the process of joining arrays to make larger ones. In fact, you made your first
array by concatenating its individual elements. The pair of square brackets [] is the concatenation
operator.
A = [a,a]
A = ​3×6

1 2 3 1 2 3
4 5 6 4 5 6
7 8 10 7 8 10

Concatenating arrays next to one another using commas is called ​horizontal​ concatenation. Each
array must have the same number of rows. Similarly, when the arrays have the same number of
columns, you can concatenate v​ ertically​ using semicolons.
A = [a; a]
A = ​6×3

1 2 3
4 5 6
7 8 10
1 2 3
4 5 6
7 8 10

Complex Numbers
Complex numbers have both real and imaginary parts, where the imaginary unit is the square root
of -1.
sqrt(-1)
ans = 0.0000 + 1.0000i
To represent the imaginary part of complex numbers, use either i or j.
c = [3+4i, 4+3j; -i, 10j]
c = ​2×2 complex

3.0000 + 4.0000i 4.0000 + 3.0000i


0.0000 - 1.0000i 0.0000 +10.0000i

Ashi Saxena 40896202718 CSE – T17


8
Experiment 3
Aim​: ​To Study Sampling and Reconstruction trainer kit.

Apparatus required​: CRO , Power Supply , Probe, Jumper wires, Sampling &
Reconstruction Trainer Kit.

Theory: ​As a first step to convert analog signals into digital form, the samples of the
analog signals are taken at regular intervals. The levels of these samples are then
encoded and send to the receiver. At the receiver these samples are recovered and
from that the original signal is reconstructed. Sampling theorem states that the
original signal can be faithfully reconstructed only if the sampling frequency is at
least double that of the highest frequency component in the sampled signal. A
sampling and reconstruction circuit is shown in figure. An FET is used as a switch to
take samples of the sine wave input. Sampling pulses are applied to the gate of the
FET that switches it ON and OFF. The input signal is sent to the output only when
the transistor is ON. Thus the output of the FET is a sampled form of the input signal.
The reconstruction circuit is a low pass filter having a cut off frequency equal to the
frequency of the analog input signal.

Working: ​Sampling is the process of measuring the instantaneous values of


continuous-time signal in a discrete form.

Ashi Saxena 40896202718 CSE – T17


9
Sampling is required:
Sampling is used any time data is to be gathered.
Data cannot be collected until the sample size (how much) and sample frequency
(how often) have been determined.

Sampling should be periodically reviewed.


When data is being collected on a regular basis to monitor a system or process, the
frequency and size of the sample should be reviewed periodically to ensure that it is
still appropriate.

Types of sampling​:

1 Ideal or Instantaneous sampling:


The principle of Instantaneous sampling is use to multiplication by an impulse
function.This is not practically possible method.

2 Natural sampling :
The principle of Natural sampling is use to chopping principle. This method is used
practically.

3 Flat top sampling ​:


The principle of Flat top sampling is uses sample and hold circuit. This method I
used practically.

Sampling Theorem:

Ashi Saxena 40896202718 CSE – T17


10
The sampling theorem is also called as Nyquist theorem.The sampling theorem
states tat, “ A continuous- time (analog) signal may represented in its samples and
recovered back if the sampling rate fs is greater than twice the maximum frequency
fm.

Fs>=2fm

Aliasing:

The phenomenon of a high-frequency component in the spectrum of a signal , taking


on the identity of a low – frequency component in the spectrum of its sampled
version.

How to prevent aliasing?

We can simply avoid aliasing by sampling the signal at a higher rate than the Nyquist
rate (Fs>=Fm). Or, we can use anti-aliasing filters. These are special low-pass filters
that are usually found in the initial stages of any digital signal processing operation.
The anti-aliasing filters attenuate the unnecessary high-frequency components of a
signal. They band-limit the input signal by removing all frequencies higher than the
signal frequencies. As a result, they help preserve a lot of information that is needed
and remove unnecessary information.

I​nterpolation

“Upsampling” is the process of inserting zero-valued ​samples ​between


original ​samples ​to increase the ​sampling ​rate. ... “​Interpolation​”, in
the DSP sense, is the process of upsampling followed by filtering. (The
filtering removes the undesired spectral images.)

Block Diagram:

Ashi Saxena 40896202718 CSE – T17


11
WAVEFORMS:

1. Sampling signal

2. Analog input signal

3. Sampled output
3.
4.Re-constructed signal

Observation:

Result: ​Analog Input is sampled at different sampling rates and then reconstructed.
Observed the waveforms and plotted. Hence we have studied sampling and
reconstruction.

Ashi Saxena 40896202718 CSE – T17


12
Inference: ​1) To reconstruct the original signal, the sampling frequency should at
least be double that of the input frequency. 2) Reconstructed signal quality improves
with increase in sampling frequency

Ashi Saxena 40896202718 CSE – T17


13
Experiment 4
Aim​:​ ​Study sampling theorem & reconstruction of signal using MATLAB

Theory:

Sampling:
A continuous time signal can be processed by processing its samples through a discrete
time system. For reconstructing the continuous time signal from its discrete time samples
without any error, the signal should be sampled at a sufficient rate that is determined by the
sampling theorem.

Nyquist Sampling Theorem:


If a signal is band limited and its samples are taken at sufficient rate then those samples
uniquely specify the signal and the signal can be reconstructed from those samples.

Code​:

%Oversampling : fs>2fm

fm =100;
fs =600; t=0:1/fs:((10/fm)-(1/fs)); %10 cycles 60 Samples
x = sin(2*pi*fm*t); fx = fft(x,64) ; xr=ifft(fx,64); % inv fft generates 64 samples
f= (-31*fs/64) : (fs/64) : (32*fs/64) ; fx=[fx(34:64) fx(1:33)];
subplot(231), stem(x), title(‘sampled signal, fm=100,fs=600’);
subplot(232), stem(f, abs(fx)), axis([-300 300 0 30]);
title(‘frequency spectrum, fm=100, fs=600’);
subplot(233), stem(xr), title(‘recovered signal, fm =100, fs=600’);

%Undersampling : fs<2fm

fm=400; x=sin(2*pi*fm*t);
fx=fft(x,64); xr = ifft(fx,64); fx=[fx(34:64) fx(1:33)];
subplot(234), stem(x), title(‘sampled signal, fm=400,fs=600’);
subplot(235), stem(f, abs(fx)), axis([-300 300 0 30]);
title(‘frequency spectrum, fm=400, fs=600’);
subplot(236), stem(xr), title(‘recovered signal, fm =400, fs=600’);

Ashi Saxena 40896202718 CSE – T17


14
Output​:

Ashi Saxena 40896202718 CSE – T17


15
Experiment 5

Aim​: ​To study modulation and demodulation of TDM-PAM (Time division multiplexing),
Pulse Modulation.

Apparatus​ ​Required​:​ ​TDM-PAM, CRO, Connecting wires.

THEORY-
1) MULTIPLEXING

2) TYPES OF MULTIPLEXING

3) PAM( IT IS SIMILAR TO FLAT-TOP SAMPLES), PWM, PPM PULSE


MODULATION- MSG(ANALOG & PULSE)

A sampled waveform is “off” most of the time, leaving the time between samples
available for other purposes. In particular, sample values from several different
signals can be interleaved into a single waveform. This is the principle of
time-division multiplexing (TDM) discussed here. The simplified system in Figure (1)
demonstrates the essential features of time division multiplexing. Several input
signals are prefiltered by the bank of input LPFs and sampled sequentially. The
rotating sampling switch or commutator at the transmitter extracts one sample from
each input per revolution. Hence, its output is a PAM waveform that contains the
individual samples periodically interleaved in time. A similar rotary switch at the
receiver, called a decommutator or distributor, separates the samples and distributes
them to another bank of LPFs for reconstruction of the individual messages. If all
inputs have the same message bandwidth ​𝑊,​ the commutator should rotate at the
rate ​𝑓𝑠 ≥ 2​𝑊 so that successive samples from any one input are spaced by ​𝑇𝑠 = 1/​𝑓𝑠
≤ 1/2​𝑊.​ The time interval ​𝑇𝑠 containing one sample from each input is called a
frame. If there are ​𝑀 input channels, the pulse-to-pulse spacing within a frame is
𝑇𝑠​/​𝑀 = 1/​𝑀𝑓𝑠 . Thus, the total number of pulses per second will be: ​𝑟 = ​𝑀𝑓𝑠 ≥ 2​𝑀𝑊
(1) which represents the pulse rate or signaling rate of the TDM signal. Our primitive
example system shows mechanical switching to generate multiplexed PAM, but
almost all practical TDM systems employ electronic switching. Regardless of the
type of pulse modulation, TDM systems require careful synchronization between
commutator and decommutator. Synchronization is a critical consideration in TDM,
because each pulse must be distributed to the correct output line at the appropriate
time. A popular bruteforce synchronization technique devotes one time slot per
frame to a distinctive marker pulse or nonpulse, as illustrated in Figure (2). These
markers establish the frame frequency ​𝑓𝑠 at the receiver, but the number of signal
channels is reduced to ​𝑀 − 1. Other synchronization methods involve auxiliary pilot
tones or the statistical properties of the TDM signal itself.

Working: ​Part I: 4-Channel PAM/TDM Transmitter 1. Carry out the connection


between modules T20E and T20D with FAST mode operation.

Ashi Saxena 40896202718 CSE – T17


16
2. Use the Function Generator block of the T20E board to generate 0.5, 1, 1.5, 2 kHz
sinusoidal modulating signals of 1Vpp respectively. Display and sketch the
generated message signals.

3. Examine the sampling pulses related to 4 channels to check that the pulses are
shifted with 25 ​𝜇​s between them. Display and sketch theses sampling pulses.

4. Use the Sampling block of the T20D board to generate 8 kHz PAM signal at each
channel. Display and sketch the PAM signals.

5. Use summation ( ∑ )block to generate PAM/TDM signal. Verify that the first-time
slot contains the synchronism (negative pulse) but other slots contain the pulses
from the PAM signals. Display and sketch the generated frame signal.

Part II: 4-Channel PAM/TDM Receiver

1. Use LINE part of T20E module with infinite band, and minimum attenuation and
noise to pass the generated PAM/TDM signal through it. Display and sketch the
reconstructed signal.

2. Use the amplifier and rectifier blocks at the receiver side to display and sketch the
amplified and rectified signals, then examine the synchronism pulses extracted by
the TDM signal.

3. Examine the sampling signals for the four demodulators to obtain the time ratio
between these signals.

4. Use the phase adjust to obtain the maximum amplitude of the demodulated
signals.

5. Examine the waveforms at the output of the reception filters and check their
correspondence to the transmitted analog signals.

6. Repeat steps (2-5) with 5, 50, and 320 kHz channel bands. Write down your
notes.

7. Repeat steps (2-5) with varying noise and attenuation levels. Write down your
notes.

ARYAN GULATI 01115602718 T1

BLOCK DIAGRAM :

Figure (1): TDM system: (a) block diagram; (b) waveforms.

Figure (2): TDM synchronization markers.

Ashi Saxena 40896202718 CSE – T17


17
Fig: PAM Generation

Ashi Saxena 40896202718 CSE – T17


18
OBSERVATION​-

1) input signals
2) multiplexed signal( tx output or rx input)
3) output signal(rx-output is similar to my transmitter input but with little distortion)

RESULT ​:

The modulation and demodulation of TDM-PAM has been studied.

PRECAUTIONS

1. Switch off the CRO when not in use


2. Handle the probes carefully
3. Trace should be taken carefully

DISCUSSION

TDM is used for long distance communication, Telephone companies and ISP
implement through digital signals.

Ashi Saxena 40896202718 CSE – T17


19
Experiment 6
Aim​: ​To verify time division multiplexing, Pulse code, modulation/demodulation using kit

​ RO, power supply, probes, TDM-PCM transmitter kit,


Apparatus Required:​ C
TDM-PCM receiver kit, jumper wires, connecting wires, RNC cable.

Theory​: ​Multiplexing​ (or muxing) is a way of sending multiple signals or streams of


information over a communications link at the same time in the form of a single,
complex signal; the receiver recovers the separate signals, a process called
demultiplexing (or demuxing).

Types of Multiplexing​:

1) TDM​: ​Time-division multiplexing​ (TDM) is a digital (or in rare cases, analog)


technology, which uses time, instead of space or frequency, to separate the
different data streams. TDM involves sequencing groups of a few bits or bytes
from each individual input stream, one after the other, and in such a way that they
can be associated with the appropriate receiver. If done sufficiently quickly, the
receiving devices will not detect that some of the circuit time was used to serve
another logical communication path.

2) FDM​: ​Frequency-division multiplexing​ (FDM) is inherently an analog


technology. FDM achieves the combining of several signals into one medium by
sending signals in several distinct frequency ranges over a single medium. In
FDM the signals are electrical signals. One of the most common applications for
FDM is traditional radio and television broadcasting from terrestrial, mobile or
satellite stations, or cable television.​

3) WDM:​ ​In ​fiber-optic communications​, wavelength-division multiplexing (WDM)


is a technology which ​multiplexes​ a number of ​optical carrier​ signals onto a
single ​optical fiber​ by using different ​wavelengths​ (i.e., colors) of ​laser​ ​light​. This
technique enables ​bidirectional​ communications over one strand of fiber, as well
as multiplication of capacity​.

PCM:​ P
​ ulse-code modulation (PCM) is a method used to ​digitally​ represent
sampled ​analog signals​. It is the standard form of ​digital audio​ in computers, ​compact
discs​, ​digital telephony​ and other digital audio applications. In a PCM ​stream​,
the ​amplitude​ of the analog signal is ​sampled​ regularly at uniform intervals, and each
sample is ​quantized​ to the nearest value within a range of digital step

Ashi Saxena 40896202718 CSE – T17


20
DIG: PCM Receiver & Transmitter Section

Ashi Saxena 40896202718 CSE – T17


21
Result​: ​Hence we have studied TDM-PCM​.
​PRECAUTIONS
​• Connections should be tight
• Take observation (waveform) carefully
• Handle CRO carefully

​ ISCUSSION ​:
D
Advantage of PCM – High reliability and efficient operation as the circuitry required
in digital.
Disadvantage – Timing filter. PCM Transmitter:

Ashi Saxena 40896202718 CSE – T17


22
Experiment 7
Aim​: To study Pulse code modulation/demodulation using matlab.

Theory​:
Multiplexing (or muxing) is a way of sending multiple signals or streams of
information over a communications link at the same time in the form of a single,
complex signal; the receiver recovers the separate signals, a process called
demultiplexing (or demuxing).

PCM:
Pulse-code modulation (PCM) is a method used to digitally represent sampled
analog signals. It is the standard form of digital audio in computers, compact discs,
digital telephony and other digital audio applications. In a PCM stream, the amplitude
of the analog signal is sampled regularly at uniform intervals, and each sample is
quantized to the nearest value within a range of digital steps.

Code​:
%Pulse Code Modulation Analog Signal-Sinusoidal
f=2
fs = 20*f
t= 0:1/fs:1
a=2
x= a*sin(2*pi*f*t)
x1 = x+a
q_op = round(x1)
enco = dec2bin(q_op)
deco = bin2dec(enco)
xr = deco-a
plot(t,x,'-r',t,xr,'k+-')
xlabel('Time')
ylabel('amplitude')
legend('original signal', 'reconstructed signal')
print -dpng figure.png

Ashi Saxena 40896202718 CSE – T17


23
Output ​:

Ashi Saxena 40896202718 CSE – T17


24
Experiment 8

Aim​ ​: ​To study Delta modulation


Apparatus Required:
CRO, power supply, probes, jumper wires, connecting wires, RNC cable

Theory​ :
The type of modulation, where the sampling rate is much higher and in which the
​ ,​ such a modulation is termed
stepsize after quantization is of a smaller value Δ
​ elta modulation.​
as d
Delta Modulation is a simplified form of DPCM technique, also viewed as 1 ​ -bit
DPCM scheme​. As the sampling interval is reduced, the signal correlation will be
higher.
Delta Modulator
The Delta Modulator comprises of a 1-bit quantizer and a delay circuit along with two
summer circuits. Following is the block diagram of a delta modulator.
Delta Demodulator
The delta demodulator comprises of a low pass filter, a summer, and a delay circuit.
The predictor circuit is eliminated here and hence no assumed input is given to the
demodulator.

DELTA MODULATOR

DELTA DEMODULATOR

Ashi Saxena 40896202718 CSE – T17


25
Code:
% it also shows slope overload cases

step = 0.1; % step size


fs = 1000; % dT = 0.001, slopw = step/dT = 1000
fm = 10; A=1; % maximum slope = 2*pi*fm*A = 62.8

t = 0:1/fs:((2/fm)-(1/fs)); % Two Cycles


x= A*sin(2*pi*fm*t); subplot(231),plot(x), title('originalsignal');

%Modulation
xq(1) = 0; d(1) = 0;
for n=2:length(x),
d(n)=sign(x(n)-xq(n-1));
xq(n)=xq(n-1)+d(n)*step;
end
subplot(232); plot(d(1:100)), axis([0 100 -1.2 1.2]);
title('First 100 output of delta modulation ')

%Demodulation
y=0;
for n=2:length(d),
y(n)=y(n-1)+d(n);
end;
subplot(233), plot(y); title('demodulation by summing');
xr=filter([0.125*ones(1,8)],1,y); % 8th order moving average filter
subplot(234), plot(xr), title('Filtering to smoothing edge')
A-2.5; x= A*x; %max. slope=2.5*62.8=157, slope overloading

%Modulation
xq(1)=0; d(1)=0;
for n=2:length(x),
d(n)=sign(x(n)-xq(n-1)); xq(n)=xq(n-1)+d(n)*step;
end

%Demodulation y=0;

Ashi Saxena 40896202718 CSE – T17


26
for n=2:length(d),
y(n)=y(n-1)+d(n);
end
subplot(235), plot(y); title('demodulation by summing, slope overload')
xr=filter([0.125*ones(1,8)],1,y);
subplot(236), plot(xr), title('Filtering , slope overload')

OUTPUT :

Ashi Saxena 40896202718 CSE – T17


27
Ashi Saxena 40896202718 CSE – T17
28
Ashi Saxena 40896202718 CSE – T17
29
Ashi Saxena 40896202718 CSE – T17
30
Ashi Saxena 40896202718 CSE – T17
31
Experiment 9

AIM :​ To study Adaptive Delta Modulation

Apparatus Required: CRO, power supply, probes, jumper wires,


connecting wires, RNC cable

Theory​ :
A larger step-size is needed in the steep slope of modulating signal and a smaller
stepsize is needed where the message has a small slope. The minute details get
missed in the process. So, it would be better if we can control the adjustment of
step-size, according to our requirement in order to obtain the sampling in a desired
fashion. This is the concept of Adaptive Delta Modulation.

​ he transmitter has a summer, a quantizer, a delay circuit, and a


Transmitter​ : T
logic circuit. Here, the step size is kept fixed between some predefined maximum
and minimum values.
The upper limit is used to control the slope overload distortion and the lower limit is
used to control the granular noise. The step size increase or decreases based on a
certain set of rules.

​ eceiver​ : ​ The ADM receiver has two parts. The first part is used to produce the
R
step size from the incoming bits. The bits are then applied to the second part of the
receiver which contains an accumulator. The function of the accumulator is to build
up the staircase waveform. The signal is then passed through a low pass filter which
is used to smoothen the staircase waveform and reconstruct the original signal.

TRANSMITTER​ :

Ashi Saxena 40896202718 CSE – T17


32
RECEIVER

CODE​:
t =0:1/29:1;
f=1;
x=4*sin(2*pi*f*t);
x=[x ones(1,10) x];
y = zeros(1,length(x));
d = zeros(1,length(x));
e= zeros(1,length(x));
s=0.1;
for i=5:length(x)
if(x(i)-y(i-1))>=0
y(i) = x(i)-s;
d(i)=-1;
elseif(x(i)-y(i-1))<0
y(i)=x(i)-1;
d(i)=-1;
end

if(sum(d(i-4:i)))>3
s=s+0.01;
elseif(sum(d(i-4:i)))<-3
s=s+0.01;
elseif(sum(d(i-4:i)))==0
s=s-0.01;
else
s=s;
end
pause;

Ashi Saxena 40896202718 CSE – T17


33
subplot (211); plot(x); hold on;
stem(y,'m');e=x-y;plot(e,'r');
title('Input,tracking and error graph');
subplot (212); stem (d,'k'); title('output data signal')

end

OUTPUT ​:

Ashi Saxena 40896202718 CSE – T17


34
​Experiment 10

AIM ​:
Generating Rayleigh distribution for different alpha

Theory :
Weibull Distribution (Rayleigh Distribution) The Weibull distribution describes data
resulting from life and fatigue tests. It is commonly used to describe failure time in
reliability studies as well as the breaking strengths of materials in reliability and
quality control tests. Weibull distributions are also used to represent various physical
quantities, such as wind speed. The Weibull distribution is a family of distributions
that can assume the properties of several other distributions. For example,
depending on the shape parameter you define, the Weibull distribution can be used
to model the exponential and Rayleigh distributions, among others. The Weibull
distribution is very flexible.

CODE:
% genrating RAYLEIGH distribution for different alpha
x =0:0.05:4;
y=raylpdf(x,0.4); %raylpdf is in build functio
subplot(131); plot(x,y); axis([0 4 0 2]); title('Alpha=0.4');
y=raylpdf(x,0.7);
subplot(132); plot(x,y) , axis([0 4 0 2]); title('Alpha=0.7');

y=poisspdf(x,1.2);
subplot(133); plot(x,y) , axis([0 4 0 2]); title('Alpha=1.2');

OUTPUT:

Ashi Saxena 40896202718 CSE – T17


35
Experiment 11

AIM ​:
Generating Poisson distribution for different alpha

Theory :
The Poisson distribution describes the number of times an event occurs in a given
interval, such as the number of telephone calls per minute or the number of errors
per page in a document. The three conditions underlying the Poisson distribution
are:
1. The number of possible occurrences in any interval is unlimited.
2. The occurrences are independent. The number of occurrences in one interval
does not affect the number of occurrences in other intervals.
3. The average number of occurrences must remain the same from interval to
interval.

Code :
% genrating Poisson distribution for different alpha

x =0:30;
y=poisspdf(x,5); %poisspdf is in build functio
subplot(131); plot(x,y); axis([0 30 0 0.2]); title('Alpha=5');
y=poisspdf(x,10);

subplot(132); plot(x,y) , axis([0 30 0 0.2]); title('Alpha=10');


y=poisspdf(x,15);
subplot(133); plot(x,y) , axis([0 30 0 0.2]); title('Alpha=15');

Ashi Saxena 40896202718 CSE – T17


36
Output :

Ashi Saxena 40896202718 CSE – T17


37
Experiment 12
AIM ​:
Generating Gaussian distribution for different alpha

Theory :

In probability theory, a normal (or Gaussian or Gauss or Laplace–Gauss) distribution


is a type of continuous probability distribution for a real-valued random variable. The
general form of its probability density function is

​ ormally distributed​,
A random variable with a Gaussian distribution is said to be n
​ ormal deviate.​
and is called a n
Normal distributions are important in ​statistics​ and are often used in
the ​natural​ and ​social sciences​ to represent real-valued r​ andom variables​ whose
distributions are not known.​[3]​[4]​ Their importance is partly due to the ​central limit
theorem​. It states that, under some conditions, the average of many samples
(observations) of a ​random variable​ with finite ​mean​ and ​variance​ is itself a random
variable—whose distribution c​ onverges​ to a normal distribution as the number of
samples increases. Therefore, physical quantities that are expected to be the sum of
many independent processes, such as ​measurement errors,​ often have distributions
that are nearly normal.

Code :
% genrating GAUSSIAN distribution for different alpha

x =-5:0.05:5;
y=normpdf(x,0,1); %mean = 0 , std deviation =1 normpdf is in build
functio

subplot(131); plot(x,y); axis([-5 5 0 1]); title('mean=0, std dev=1');


y=raylpdf(x,0,0.5);

subplot(132); plot(x,y) , axis([-5 5 0 1]); title('mean=0, std dev=0.5');


y=poisspdf(x,1,1);

subplot(133); plot(x,y) , axis([-5 5 0 1]); title('mean=1, std dev=1');

Ashi Saxena 40896202718 CSE – T17


38
Output :

Ashi Saxena 40896202718 CSE – T17


39
Experiment 13

AIM​ ​:
To perform line coding using MATLAB

Theory
A l​ ine code​ is the code used for data transmission of a digital signal over a
transmission line. This process of coding is chosen so as to avoid overlap and
distortion of signal such as inter-symbol interference.

Unipolar Signaling
Unipolar signaling is also called as ​On-Off Keying​ or simply O ​ OK.​
The presence of pulse represents a ​1​ and the absence of pulse represents a ​0​.
There are two variations in Unipolar signaling −
● Non Return to Zero ​NRZ
● Return to Zero R ​ Z
Unipolar Non-Return to Zero ​NRZ
In this type of unipolar signaling, a High in data is represented by a positive pulse
called as ​Mark​, which has a duration ​T​0​ equal to the symbol bit duration. A Low in
data input has no pulse.
Unipolar Return to Zero ​RZ
In this type of unipolar signaling, a High in data, though represented by a ​Mark
pulse,​ its duration ​T​0​ is less than the symbol bit duration. Half of the bit duration
remains high but it immediately returns to zero and shows the absence of pulse
during the remaining half of the bit duration.

Polar Signaling
There are two methods of Polar Signaling. They are −
● Polar NRZ
● Polar RZ
Polar NRZ
In this type of Polar signaling, a High in data is represented by a positive pulse,
while a Low in data is represented by a negative pulse.
Polar RZ
In this type of Polar signaling, a High in data, though represented by a ​Mark pulse​,
its duration ​T0​ ​ is less than the symbol bit duration. Half of the bit duration remains
high but it immediately returns to zero and shows the absence of pulse during the
remaining half of the bit duration.
However, for a Low input, a negative pulse represents the data, and the zero level
remains same for the other half of the bit duration.

Ashi Saxena 40896202718 CSE – T17


40
CODE

%NRZ UNIPOLAR LINE CODING


%INPUT SEQUENCE
n=[1,0,1,0,1];
%Mapping
for ii=1:length(n)
if n(ii)==1;
nn(ii)=3;
else
nn(ii)=0;
end
end
%Pulse Shaping
i=1;
t=0:0.01:length(n);
for j=1:length(t)
if t(j)<=i;
y(j)=nn(i);
else
y(j)=nn(i);
i=i+1;
end
end
%Plotting
plot(t,y,'r-');
axis([0 length(n) -5 5]);

Ashi Saxena 40896202718 CSE – T17


41
CODE
For polar nrz:

%NRZ UNIPOLAR LINE CODING


%INPUT SEQUENCE
n=[1,0,1,0,1];
%Mapping
for ii=1:length(n)
if n(ii)==1;
nn(ii)=3;
else
nn(ii)=-3;
end
end
%Pulse Shaping
i=1;
t=0:0.01:length(n);
for j=1:length(t)
if t(j)<=i;
y(j)=nn(i);
else
y(j)=nn(i);
i=i+1;
end
end
%Plotting
plot(t,y,'r-');
axis([0 length(n) -5 5]);

Ashi Saxena 40896202718 CSE – T17


42
Experiment 14
AIM​ ​:
To study & implement ASK & OOK Modulation

Theory :
Amplitude Shift Keying ASK is a type of Amplitude Modulation which
represents the binary data in the form of variations in the amplitude of a
signal.
Any modulated signal has a high frequency carrier. The binary signal
when ASK modulated, gives a zero value for Low input while it gives the
carrier output for High input.

Code:
clc;
close all;
clear all;
x=round (rand (1,10));
t1=0:0.001:0.999;
s=5*sin(2*pi*2*t1);
s1=sin (2*pi*2*t1) ;
ask=[]
for i=1:10
if (x(i)==1)
ask = [ask s]
else
ask = [ask s1]
end
end
subplot (2,1,1)
stairs (0:9, x)
axis([0,10, -0.2,1.2])
subplot (2,1,2);
plot (0:0.001: 9.999, ask);

Ashi Saxena 40896202718 CSE – T17


43
Output:

Code:
clc;
close all;
clear all;
x=round (rand (1,10));
t1=0:0.001:0.999;
s=5*sin(2*pi*2*t1);
s1=sin (2*pi*2*t1) ;
ask=[]
for i=1:10
if (x(i)==1)
ask = [ask s]

else
ask = [ask zeros(1,1000)]

end

end
subplot (2,1,1)
stairs (0:9, x)
axis([0,10, -0.2,1.2])
subplot (2,1,2);
plot (0:0.001: 9.999, ask);

Ashi Saxena 40896202718 CSE – T17


44
Output​:

Ashi Saxena 40896202718 CSE – T17


45
Experiment 15
AIM​ ​:
To study & implement FSK using MATLAB

Theory :
Frequency Shift Keying FSK is the digital modulation technique in which
the frequency of the carrier signal varies according to the digital signal
changes. FSK is a scheme of frequency modulation.
The output of a FSK modulated wave is high in frequency for a binary
High input and is low in frequency for a binary Low input. The binary 1s
and 0s are called Mark and Space frequencies.

Code:
clc;
close all;
clear all;
x=round (rand (1,10));
t=0:0.001:0.999;
s=5*sin(2*pi*4.5*t);
s1=5*sin (2*pi*2*t) ;
ask=[];
psk=[];
for i=1:10
if x(i)==1
ask = [ask s];
else
ask = [ask s1];
end
end;
subplot (2,1,1)
stairs (0:9, x)
xlabel('Time');
ylabel('Amplitude');
axis([0,10,-0.2,1.2]);
subplot(2,1,2);
plot(0:0.001:9.999,ask);
xlabel('Time');
ylabel('Amplitude');

Ashi Saxena 40896202718 CSE – T17


46
OUTPUT:

Ashi Saxena 40896202718 CSE – T17


47
Experiment 16
AIM​ ​:
To study & implement PSK using MATLAB

Theory :
Phase Shift Keying PSK is the digital modulation technique in which the
phase of the carrier signal is changed by varying the sine and cosine
inputs at a particular time. PSK technique is widely used for wireless
LANs, bio-metric, contactless operations, along with RFID and Bluetooth
communications.

PSK is of two types, depending upon the phases the signal gets shifted.
They are −
Binary Phase Shift Keying BPSK
This is also called as 2-phase PSK or Phase Reversal Keying. In this
technique, the sine wave carrier takes two phase reversals such as 0°
and 180°.

BPSK is basically a Double Side Band Suppressed Carrier DSBSC


modulation scheme, for message being the digital information.

Quadrature Phase Shift Keying QPSK


This is the phase shift keying technique, in which the sine wave carrier
takes four phase reversals such as 0°, 90°, 180°, and 270°.

If this kind of techniques are further extended, PSK can be done by eight
or sixteen values also, depending upon the requirement.

Code:
clc;
close all;
clear all;
x=round (rand (1,10));
t1=0:0.001:0.999;
s=sin(2*pi*2*t1);
s1=-sin (2*pi*2*t1) ;
psk=[]
for i=1:10
if (x(i)==1)
psk = [psk s]

else

Ashi Saxena 40896202718 CSE – T17


48
psk = [psk s1]
end

end
subplot (2,1,1)
stairs (0:9, x)
grid on;
title('Phase Shift Keying');

ylabel('Amplitude');
xlabel('Time');

axis([0,10,-0.2,1.2]);
subplot(2,1,2);
plot(0:0.001:9.999,psk);
grid on;
title('Output Wave Form');
ylabel('Amplitude');
xlabel('Time');

OUTPUT

Ashi Saxena 40896202718 CSE – T17


49
Ashi Saxena 40896202718 CSE – T17
50

You might also like