0% found this document useful (0 votes)
10 views36 pages

DC FILE

The document is a practical file for digital communication experiments conducted by Mashir Nizami, covering various topics such as encoding/decoding line codes, sampling theorem, signal reconstruction, Pulse Code Modulation, and Frequency Shift Keying. Each experiment includes an aim, theoretical background, MATLAB code, and conclusions drawn from the results. The file serves as a comprehensive guide to understanding and implementing key concepts in digital communication systems.

Uploaded by

mashirnizami786
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)
10 views36 pages

DC FILE

The document is a practical file for digital communication experiments conducted by Mashir Nizami, covering various topics such as encoding/decoding line codes, sampling theorem, signal reconstruction, Pulse Code Modulation, and Frequency Shift Keying. Each experiment includes an aim, theoretical background, MATLAB code, and conclusions drawn from the results. The file serves as a comprehensive guide to understanding and implementing key concepts in digital communication systems.

Uploaded by

mashirnizami786
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

Digital communication practical file

NAME MASHIR NIZAMI

ENROLLMENT NO. 01676802818

BRANCH ECE 3

MASHIR NIZAMI(01676802818) 1|Page


INDEX

[Link] INDEX [Link]

1 To study encoding and decoding of various line 3-8


codes

2 To study sampling theorem 9-13

3 To verify reconstruction of signal using 14-16


sampling theorem.
4 To study of Pulse Code Modulation system 17-19

5 To Implement Frequency Shift Keying ( F.S.K.) 20-25


modulation using MATLAB
6 To implement Amplitude shift keying (ASK) 26-29
modulation using MATLAB
7 Analysis of BPSK modulation under AWGAN 30-34
channel.

8 Analysis of QPSK modulation and demodulation 35-37


using different noise levels.

MASHIR NIZAMI(01676802818) 2|Page


EXPERIMENT-1

AIM: - To study encoding and decoding of various line codes

SOFTWARE USED:- MATLABR2019a.

Theory:

Line coding is the process of converting digital data to digital signals. By


this technique we convert a sequence of bits to a digital signal. At the
sender side digital data are encoded into a digital signal and at the
receiver side the digital data are recreated by decoding the digital signal.

Line coding divides into three categories:

1. Unipolar (eg. NRZ scheme).


2. Polar (eg. NRZ-L, NRZ-I, RZ, and Biphase – Manchester and
differential Manchester).
3. Bipolar (eg. AMI and Pseudoternary).
Unipolar scheme –
The presence of pulse represents a 1 and the absence of pulse
represents a 0.

• Non return to zero (NRZ) – It is unipolar line coding scheme in


which positive voltage defines bit 1 and the zero voltage defines

MASHIR NIZAMI(01676802818) 3|Page


bit 0. Signal does not return to zero at the middle of the bit thus
it is called NRZ.
• Return to zero (RZ) – In this scheme signal goes to 0 in the
middle of each bit.

Bipolar schemes –
In this scheme there are three voltage levels positive, negative, and
zero. The voltage level for one data element is at zero, while the
voltage level for the other element alternates between positive and
negative.

• Non return to zero (NRZ) - In bipolar NRZ-level the voltage


"swings" from positive to negative on the trailing edge of the
previous bit clock cycle.

• Return to zero (RZ) - A binary one is encoded as +V volts, a


binary zero is encoded as -V volts, and 0 volt is used to provide
padding and separation between bits.

• Alternate Mark Inversion (AMI) – A neutral zero voltage


represents binary 0. Binary 1’s are represented by alternating
positive and negative voltages.
Biphase (Manchester and Differential Manchester ) – Manchester
encoding is somewhat combination of the RZ and NRZ-L schemes. The

MASHIR NIZAMI(01676802818) 4|Page


voltage remains at one level during the first half and moves to the other
level in the second half.

PROGRAM CODE-
r=round(rand(1,10));
sgn=1;
for i=1:10
t=i:0.001:i+1-0.001;
if r(i)==1
nrz_unipolar=square(2*pi*t,100);
nrz_bipolar=square(2*pi*t,100);
rz_unipolar=(1+square(2*pi*t))/2;
rz_bipolar=(1+square(2*pi*t))/2;
ami_nrz=sgn+square(2*pi*t);
manchester=square(2*pi*t,50);
else
nrz_unipolar=0;
nrz_bipolar=-square(2*pi*t,100);
rz_unipolar=0
rz_bipolar=-(1+square(2*pi*t))/2;
ami_nrz=0;
manchester=-(square(2*pi*t,50));
end

MASHIR NIZAMI(01676802818) 5|Page


subplot(6,6,1);
plot(t,nrz_unipolar,'red');
axis([1 11 -1.5 1.5])
xlabel('time')
ylabel('amplitude')
title('nrz_unipolar')
hold on;
grid on;
subplot(6,1,2)
axis([1 11 -1.5 1.5])
plot(t,nrz_bipolar,'blue');
ylabel('amplitude')
title('nrz_unipolar')
xlabel('time')
ylabel('amplitude')
title('nrz_unipolar')
hold on;
grid on;
subplot(6,1,3)
plot(t,rz_unipolar,'red');
axis([1 11 -1.5 1.5])
xlabel('time')
ylabel('amplitude')
title('rz_unipolar')
MASHIR NIZAMI(01676802818) 6|Page
hold on;
grid on;
subplot(6,14)
plot(t,rz_bipolar,'blue');
axis([1 11 -1.5 1.5])
xlabel('time')
ylabel('amplitude')t
itle('rz_bipolar')
hold on;
grid on; subplot(6,1,5)
plot(t,ami_nrz,'blue');
axis([1 11 -1.5 1.5])
xlabel('time')
ylabel('amplitude')
title('ami_rz')
hold on;
grid on;
subplot(6,1,6)
plot(t,manchester,'red');
axis([1 11 -1.5 1.5])
xlabel('time')
ylabel('amplitude')
title('nrz_unipolar')
hold on;
MASHIR NIZAMI(01676802818) 7|Page
grid on;
end

OUTPUT :

CONCLUSION:

Various line codes have been studied and performed

MASHIR NIZAMI(01676802818) 8|Page


EXPERIMENT-2

AIM: - To study sampling theorem.

SOFTWARE USED:- MATLABR2019a.

Theory:

In sampling theorem, the input signal is in an analog form of signal and


the second input signal is a sampling signal, which is a pulse train signal
and each pulse is equidistance with a period of “Ts”. This sampling
signal frequency should be more than twice of the input analog signal
frequency
The sampling theorem can be defined as the conversion of an analog
signal into a discrete form by taking the sampling frequency as twice the
input analog signal frequency. Input signal frequency denoted by Fm
and sampling signal frequency denoted by Fs.
The output sample signal is represented by the samples. These samples
are maintained with a gap, these gaps are termed as sample period or
sampling interval (Ts). And the reciprocal of the sampling period is
known as “sampling frequency” or “sampling rate”. The number of
samples is represented in the sampled signal is indicated by the
sampling rate.
Sampling frequency Fs=1/Ts

MASHIR NIZAMI(01676802818) 9|Page


Sampling Theorem Statement
Sampling theorem states that “continues form of a time-variant signal
can be represented in the discrete form of a signal with help of samples
and the sampled (discrete) signal can be recovered to original form.
If the sampling frequency (Fs) equals twice the input signal frequency
(Fm), then such a condition is called the Nyquist Criteria for sampling.
When sampling frequency equals twice the input signal frequency is
known as “Nyquist rate”.

Fs=2Fm

• Oversampling is the process of sampling a signal at a sampling


frequency significantly higher than the Nyquist rate
Fs ≥ 2Fm

• Undersampling or bandpass sampling is a technique where


one samples a bandpass-filtered signal at a sample rate below
its Nyquist rate (twice the upper cutoff frequency.
Fs<2Fm

PROGRAM CODE-
clc;
clear all;
MASHIR NIZAMI(01676802818) 10 | P a g e
a=input('amplitude');
fm=input('freq of signal');
t=0:0.001/fm:4/fm
signal=a*sin(2*pi*fm*t);
fs=input('enter sampling freq');
p=(1+square(2*pi*fs*t))/2;
sample=signal.*p;
subplot(2,2,1)
plot(signal)
title('signal')
xlabel('t')
ylabel('freq')
subplot(2,2,2)
plot(p)
title('square wave')
xlabel('t')
ylabel('freq')
subplot(2,2,3)
plot(sample)
title('sample')
xlabel('t')
ylabel('freq')

MASHIR NIZAMI(01676802818) 11 | P a g e
OUTPUT:

UNDER SAMPLING

OVER SAMPLING

MASHIR NIZAMI(01676802818) 12 | P a g e
PERFECT SAMPLING

CONCLUSION:

Sampling theorem been studied and performed.

MASHIR NIZAMI(01676802818) 13 | P a g e
EXPERIMENT-3

AIM:To verify reconstruction of signal using sampling theorem.

SOFTWARE USED:MATLABR2019a

THEORY:
Reconstruction usually means the determination of an original
continuous signal from a sequence of equally spaced samples x(nt).
The process of reconstructing a continuous time signal x(t) from its
samples x(nt) is known as interpolation.

PROGRAM CODE:
clc;
clear all;
a=input('amplitude');
fm =input('enter max. frequency');
t=0:0.001/fm:4/fm;
signal=a*sin(2*pi*fm*t);
fs=input('enter sampling frequency');
p=(1+square(2*pi*fs*t))/2;
sampled=signal.*p;
subplot(2,2,1);

MASHIR NIZAMI(01676802818) 14 | P a g e
plot(signal);
title('signal');
xlabel('t');
ylabel('frequency')
[z, p]= butter(8,1/90,'low');
r=filter(z,p,sampled);
subplot(2,2,2);
plot(r);
title('orignal signal with order 8');
xlabel('t');
ylabel('frequency')
[z, p]= butter(2,1/90,'low');
r=filter(z,p,sampled);
subplot(2,2,3);
plot(r);
title('orignal signal with order 2');
xlabel('t');
ylabel('frequency')
[z, p]= butter(4,1/90,'low');
r=filter(z,p,sampled);
subplot(2,2,4);
plot(r);
title('orignal signal with order 4');

MASHIR NIZAMI(01676802818) 15 | P a g e
xlabel('t');
ylabel('frequency')

OUTPUT:

Command window

CONCLUSION:

Reconstruction of signal has been studied and verified.

MASHIR NIZAMI(01676802818) 16 | P a g e
EXPERIMENT-4

AIM: - To study of Pulse Code Modulation system.

SOFTWARE USED: - MATLABR2019a.

THEORY:

Pulse code modulation is a method that is used to convert an analog


signal into a digital signal so that a modified analog signal can be
transmitted through the digital communication network. PCM is in
binary form, so there will be only two possible states high and low(0
and 1). We can also get back our analog signal by demodulation. The
Pulse Code Modulation process is done in three steps Sampling,
Quantization, and Coding. There are two specific types of pulse code
modulations such as differential pulse code modulation(DPCM) and
adaptive differential pulse code modulation(ADPCM)

MASHIR NIZAMI(01676802818) 17 | P a g e
PROGRAM CODE-
clc;
closeall;
clearall;
f=input(‘enter
frequency’); fs=20*f;
t=0:1/fs:1;
a=2;
x=a*sin(2*pi*f*t)
;x1=x+a;
qp=round(x1)
enco=de2bi(qp,'left-msb');
deco=bi2de(enco,'left-
msb'); xr=deco-a;
subplot(2,2,1
) plot(t,x,'r-');
xlabel('t')
ylabel('amp')
subplot(2,2,2)
plot(t,x,'r-',t,xr,'k+-
') xlabel(‘t’)
ylabel(‘amp’)
sqnr=20*log10(norm(x)/norm(x-

MASHIR NIZAMI(01676802818) 18 | P a g e
qp))
OUTPUT:

CONCLUSION:

Pulse code modulation been studied and performed.

MASHIR NIZAMI(01676802818) 19 | P a g e
EXPERIMENT-5

AIM: -To Implement Frequency Shift Keying ( F.S.K.) modulation using


MATLAB.

SOFTWARE USED:- MATLABR2019a.

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.

MASHIR NIZAMI(01676802818) 20 | P a g e
The following image is the diagrammatic representation of FSK
modulated waveform along with its input.

FSK Modulator

The FSK modulator block diagram comprises of two oscillators with a


clock and the input binary sequence. Following is its block diagram.

The two oscillators, producing a higher and a lower frequency signals,


are connected to a switch along with an internal clock. To avoid the
abrupt phase discontinuities of the output waveform during the
transmission of the message, a clock is applied to both the oscillators,

MASHIR NIZAMI(01676802818) 21 | P a g e
internally. The binary input sequence is applied to the transmitter so as
to choose the frequencies according to the binary input.

FSK Demodulator

There are different methods for demodulating a FSK wave. The main
methods of FSK detection are asynchronous detector and synchronous
detector. The synchronous detector is a coherent one, while
asynchronous detector is a non-coherent one.

Asynchronous FSK Detector

The block diagram of Asynchronous FSK detector consists of two band


pass filters, two envelope detectors, and a decision circuit.

The FSK signal is passed through the two Band Pass Filters (BPFs), tuned
to Space and Mark frequencies. The output from these two BPFs look

MASHIR NIZAMI(01676802818) 22 | P a g e
like ASK signal, which is given to the envelope detector. The signal in
each envelope detector is modulated asynchronously.

The decision circuit chooses which output is more likely and selects it
from any one of the envelope detectors. It also re-shapes the waveform
to a rectangular one.

Synchronous FSK Detector

The block diagram of Synchronous FSK detector consists of two mixers


with local oscillator circuits, two band pass filters and a decision circuit.
Following is the diagrammatic representation.

The FSK signal input is given to the two mixers with local oscillator
circuits. These two are connected to two band pass filters. These
combinations act as demodulators and the decision circuit chooses
which output is more likely and selects it from any one of the detectors.
The two signals have a minimum frequency separation.

MASHIR NIZAMI(01676802818) 23 | P a g e
For both of the demodulators, the bandwidth of each of them depends
on their bit rate. This synchronous demodulator is a bit complex than
asynchronous type demodulators.

PROGRAM CODE-

clc;
Clear all;
Close all;
A=input('enter amplitude =');
N=input('enter no. Of bits = ');
R=round(rand(1,n));
T=0:0.001:1;
S1=a*sin(2*pi*10*t);
S2=a*sin(2*pi*5*t);
Fsk=[];
For i=1:n
If r(i)==1
Fsk=[fsk s1]
Else
Fsk=[fsk s2]
End
End
Ylim =([-5,5]);

MASHIR NIZAMI(01676802818) 24 | P a g e
Subplot(1,1,1);
Stairs (0:n-1,r);
%subplot(3,2,2);
Plot (fsk);

OUTPUT:

CONCLUSION:
Frequency Shift Keying ( F.S.K.) modulation have been studied and
performed.

MASHIR NIZAMI(01676802818) 25 | P a g e
EXPERIMENT-6

AIM: - To implement Amplitude shift keying (ASK) modulation


using MATLAB.

SOFTWARE USED:- MATLABR2019a.

THEORY:

Amplitude Shift Keying (ASK) is the digital modulation technique. In


amplitude shift keying, the amplitude of the carrier signal is varied to
create signal elements. Both frequency and phase remain constant
while the amplitude changes. In ASK, the amplitude of the carrier
assumes one of the two amplitudes dependent on the logic states of
the input bit stream. This modulated signal can be expressed as:

Amplitude shift keying (ASK) in the context of digital signal


communications is a modulation process, which imparts to a sinusoid
two or more discrete amplitude levels. These are related to the number
of levels adopted by the digital message. For a binary message sequence
there are two levels, one of which is typically zero. Thus the modulated
waveform consists of bursts of a sinusoid. Figure 1 illustrates a binary
ASK signal (lower), together with the binary sequence which initiated it

MASHIR NIZAMI(01676802818) 26 | P a g e
(upper). Neither signal has been band limited.

There are sharp discontinuities shown at the transition points. These


result in the signal having an unnecessarily wide bandwidth. Band
limiting is generally introduced before transmission, in which case
these discontinuities would be ‘rounded off’. The band limiting may be
applied to the digital message, or the modulated signal itself. The data
rate is often made a sub-multiple of the carrier frequency.

PROGRAM CODE-

clear all;
close all;
clc;
fm = input('ENTER FREQUENCY === ');
n = input('ENTER NO. OF BITS ===');
MASHIR NIZAMI(01676802818) 27 | P a g e
r = round ( rand (1,n));
t = 0:0.0001:1;
s1 = 3*sin (2*pi*fm*t);
s2 = 0* sin(2*pi*fm*t);
ask=[];
for i=1:n
if r(i)==1
ask=[ask s1]
else
ask=[ask s2]
end
end

ylim = ([-5,5]);

subplot (3,1,1);

stairs (0:n-1,r);

subplot (3,1,2);
plot (ask);

MASHIR NIZAMI(01676802818) 28 | P a g e
OUTPUT:

CONCLUSION:

Amplitude shift keying (ASK) modulation been studied and


performed.

MASHIR NIZAMI(01676802818) 29 | P a g e
EXPERIMENT-7

AIM -:Analysis of BPSK modulation under AWGAN channel.

SOFTWARE USED:- MATLABR2019a.

THEORY:
In carrier-phase modulation, the information that is transmitted over a
communication channel is impressed on the phase of the carrier.
Science the range of the carrier phase is 0 ≤ θ ≤ 2Π,the carrier phases
used to transmit digital information via digital-phase modulation are
θm=2Πm/M, for m=0,1,2…..,[Link] for binary phase
modulation(M=2),the two carrier phase are θ0 =0 and θ1 = Π radian. For
M-array phase modulation=2k, where k is the number of information
bits per transmitted symbol.

The general representation of a set of M carrier-phase-modulated signal


waveforms is

um (t) = AgT(t) cos(2Πfct+2Πm/M) , m=0,1,………,M-1

Where, gT(t) is the transmitting filter pulse shape, which determines the
spectral characteristics of the transmitted signal, and A is the signal
amplitude. This type of digital phase modulation is called phase- shift-
keying.

MASHIR NIZAMI(01676802818) 30 | P a g e
PROGRAM CODE-

clc;
clear all;
close all;
warning off;
n=[1,0,1,0,1];
%$n= randint (1,5);
for ii=1:length (n) if
n(ii)==1;
nn(ii)=1;
else
nn(ii)=0;
end
end

%pulse shaping
i=1;
MASHIR NIZAMI(01676802818) 31 | P a g e
t=0:0.01 : length(n)
for j=1:length (t)
if t(j)<=i;
y(j)=nn(i);
else
y(j)=nn(ii);
i=i+1;
end
%plotting
subplot (411);
plot(t,y,'r-');
%carrier
c=cos(2*pi*2*t)
subplot (412);
plot(t,y,'k-');
%bask modulation
x=y.*c;
subplot (413);
plot(t,x,'b-');
%Detection and reconstruction
for j=1:length (t)
if x(j)==c(j)

det(j)=1;

MASHIR NIZAMI(01676802818) 32 | P a g e
else
det(j)=0;
end
end

subplot (414);
plot(t,det,'m-');

OUTPUT:

CONCLUSION:

BPSK modulation been studied and performed.


MASHIR NIZAMI(01676802818) 33 | P a g e
EXPERIMENT-8

AIM -: Analysis of QPSK modulation and demodulation using


different noise levels.

SOFTWARE USED:- MATLABR2019a.

THEORY:

Quadrature Phase Shift Keying (QPSK) is the digital modulation


technique. Quadrature Phase Shift Keying (QPSK) is a form of Phase
Shift Keying in which two bits are modulated at once, selecting one of
four possible carrier phase shifts (0, Π/2, Π, and 3Π/2). QPSK perform
by changing the phase of the In-phase (I) carrier from 0° to 180° and
the Quadrature-phase (Q) carrier between 90° and 270°. This is used
to indicate the four states of a 2-bit binary code.

MASHIR NIZAMI (01676802818) 34 | P a g e


QPSK perform by changing the phase of the In-phase (I) carrier from
0° to 180° and the Quadrature-phase (Q) carrier between 90° and
270°. This is used to indicate the four states of a 2-bit binary code.
Each state of these carriers is referred to as a Symbol. Quadrature
Phase-shift Keying (QPSK) is a widely used method of transferring
digital data by changing or modulating the phase of a carrier signal.

In QPSK digital data is represented by 4 points around a circle which


correspond to 4 phases of the carrier signal.

PROGRAM CODE-

clc;
clear all;
close all;
M=4;
x= randint(1000,1,M);
y1= pskmod (x,M);
yln= awgn(y1,5);
Scatterplot(yln);
ylr= pskmod(yln,M);
[num_error,er-rate]==symer(x,ylr)

MASHIR NIZAMI (01676802818) 35 | P a g e


OUTPUT:

CONCLUSION:

QPSK modulation been studied and performed.

MASHIR NIZAMI (01676802818) 36 | P a g e

You might also like