You are on page 1of 7

15L712 – DIGITAL COMMUNICATION SYSTEMS LABORATORY

BALAGANESH S 19L402

Laboratory report submitted in partial fulfilment of the requirements for the


degree of

BACHELOR OF ENGINEERING
Branch: ELECTRONICS AND COMMUNICATION ENGINEERING
of Anna University.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
PSG COLLEGE OF TECHNOLOGY
(Autonomous Institution)
COIMBATORE-641004
Expt:3 PSD of Line Coding Techniques

Date: 12/08/2021

Aim:

To design and test different pulse coding techniques using Matlab.

Objectives:

1. Finding PSD of Unipolar RZ/NRZ


2. Finding PSD of Bipolar Coding scheme
3. Finding PSD of Manchester Coding Scheme

Software Used:

S No Software Version
1 Matlab R2020

Theory:

Line code is the signaling scheme used to represent data on a communication line.Some of the requirements are:

When transmitting binary data over long distances encoding the binary data using line codes should satisfying
following requirements.

 All possible binary sequences can be transmitted.


 The line code encoded signal must occupy small transmission bandwidth, so that more information
can be transmitted per unit bandwidth.
 Error probability of the encoded signal should be as small as possible
 Since long distance communication channels cannot transport low frequency content (example : DC
component of the signal , such line codes should eliminate DC when encoding). The power spectral
density of the encoded signal should also be suitable for the medium of transport.
 The receiver should be able to extract timing information from the transmitted signal.
 Guarantee transition of bits for timing recovery with long runs of 1s and 0s in the binary data.
 Support error detection and correction capability to the communication system.

Unipolar Non-Return-to-Zero (NRZ) level and Return-to-Zero (RZ) level codes

Unipolar NRZ(L) is the simplest of all the line codes, where a positive voltage represent binary bit 1 and zero volts
represents bit 0. It is also called on-off keying.In unipolar return-to-zero (RZ) level line code, the signal value returns
to zero between each pulse.
For both unipolar NRZ and RZ line coded signal, the average value of the signal is not zero and hence they have a
significant DC component (note the impulse at zero frequency in the power spectral density (PSD) plot).

The DC impulses in the PSD do not carry any information and it also causes the transmission wires to heat up. This is
a wastage of communication resource.

Unipolar coded signals do not include timing information, therefore long runs of 0s and 1s can cause loss
of synchronization at the receiver.

Bipolar Non-Return-to-Zero (NRZ) level code

In bipolar NRZ(L) coding, binary bit 1 is mapped to positive voltage and bit 0 is mapped to negative voltage. Since
there are two opposite voltages (positive and negative) it is a bipolar signaling scheme.

Evident from the power spectral densities, the bipolar NRZ signal is devoid of a significant impulse at the zero
frequency (DC component is very close to zero). Furthermore, it has more power than the unipolar line code (note:
PSD curve for bipolar NRZ is slightly higher compared to that of unipolar NRZ). Therefore, bipolar NRZ signals provide
better signal-to-noise ratio (SNR) at the receiver.

Bipolar NRZ signal lacks embedded clock information, which posses synchronization problems at the receiver when
the binary information has long runs of 0s and 1s.

Manchester encoding

In Manchester encoding, the signal for each binary bit contains one transition. For example, bit 0 is represented by a
transition from negative to positive voltage and bit 1 is represented by transitioning from one positive to negative
voltage. Therefore, it is considered to be self clocking and it is devoid of DC component.

Digitally Manchester encoding can be implemented by XORing the binary data and the clock, followed by mapping
the output to appropriate voltage levels.
PRELAB QUESTIONS
1.What is line code?
A line 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.
2. Types of Line Code?
 Unipolar
 Polar
 Bi-polar
3. What is unipolar signalling?
Unipolar signalling is also called as On-Off Keying or simply OOK.
The presence of pulse represents a 1 and the absence of pulse represents a 0.
There are two variations in Unipolar signalling
 Non Return to Zero NRZ
 Return to Zero RZ
4. Types of polar Signalling?
There are two methods of Polar Signalling.
 Polar NRZ
 Polar RZ
5. What is BI-Polar Signalling?
This is an encoding technique which has three voltage levels namely +, - and 0. Such a signal is called as duo-binary
signal.
Even in this method, we have two types.
 Bipolar NRZ
 Bipolar RZ
Code:
%Simulate line codes and plot power spectral densities (PSD)
clearvars;
clc;
L = 32; %number of digital samples per data bit
Fs = 8*L; %Sampling frequency
voltageLevel = 5; %peak voltage level in Volts
data = rand(10000,1)>0.5; %random 1s and 0s for data
clk = mod(0:2*numel(data)-1,2).'; %clock samples

%converting the bits to sequences and mapping to voltage levels


clk_sequence=reshape(repmat(clk,1,L).',1,length(clk)*L);
data_sequence=reshape(repmat(data,1,2*L).',1,length(data)*2*L);
unipolar_nrz_l = voltageLevel*data_sequence;
nrz_encoded = voltageLevel*(2*data_sequence - 1);
unipolar_rz = voltageLevel*and(data_sequence,not(clk_sequence));
manchester_encoded = voltageLevel*(2*xor(data_sequence,clk_sequence)-1);

figure; %Plot signals in time domain


subplot(7,1,1); plot(clk_sequence(1:800)); title('Clock');
subplot(7,1,2); plot(data_sequence(1:800)); title('Data')
subplot(7,1,3); plot(unipolar_nrz_l(1:800)); title('Unipolar non-return-to-zero level')
subplot(7,1,4); plot(nrz_encoded(1:800)); title('Bipolar Non-return-to-zero level')
subplot(7,1,5); plot(unipolar_rz(1:800)); title('Unipolar return-to-zero')

subplot(7,1,6); plot(manchester_encoded(1:800)); title('Manchester Encoded - IEEE


802.3')

figure; %Plot power spectral density


ns = max(size(unipolar_nrz_l));
na = 16;%averaging factor to plot averaged welch spectrum
w = hanning(floor(ns/na));%Hanning window
%Plot Welch power spectrum using Hanning window
[Pxx1,F1] = pwelch(unipolar_nrz_l,w,[],[],1,'onesided');
[Pxx2,F2] = pwelch(nrz_encoded,w,[],[],1,'onesided');
[Pxx3,F3] = pwelch(unipolar_rz,w,[],[],1,'onesided');
[Pxx4,F4] = pwelch(manchester_encoded,w,[],[],1,'onesided');

semilogy(F1,Pxx1,'DisplayName','Unipolar-NRZ-L');hold on;
semilogy(F2,Pxx2,'DisplayName','Bipolar NRZ(L)');
semilogy(F3,Pxx3,'DisplayName','Unipolar-RZ');
semilogy(F4,Pxx4,'DisplayName','Manchester');
legend();
POST LAB QUESTIONS:
1.what is data encoding?
Encoding is the process of using various patterns of voltage or current levels to represent 1s and 0s of the digital
signals on the transmission link.
The common types of line encoding are Unipolar, Polar, Bipolar, and Manchester.
2. Properties of line encoding.
 As the coding is done to make more bits transmit on a single signal, the bandwidth used is much reduced.
 For a given bandwidth, the power is efficiently used.
 The probability of error is much reduced.
 Error detection is done and the bipolar too has a correction capability.
 Power density is much favorable.
 The timing content is adequate.
 Long strings of 1s and 0s is avoided to maintain transparency.
3. What are the advantage and disadvantage of Unipolar NRZ?
Advantages
The advantages of Unipolar NRZ are
 It is simple.
 A lesser bandwidth is required.
Disadvantages
The disadvantages of Unipolar NRZ are
 No error correction done.
 Presence of low frequency components may cause the signal droop.
 No clock is present.
 Loss of synchronization is likely to occur (especially for long strings of 1s and 0s).
4. What are the advantage and disadvantage of Unipolar RZ?
Advantages
The advantages of Unipolar RZ are
 It is simple.
 The spectral line present at the symbol rate can be used as a clock.
Disadvantages
The disadvantages of Unipolar RZ are
 No error correction.
 Occupies twice the bandwidth as unipolar NRZ.
 The signal droop is caused at the places where signal is non-zero at 0 Hz.
5. What are the advantage and disadvantage of Bi-polar ?
advantages
 It is simple.
 No low-frequency components are present.
 Occupies low bandwidth than unipolar and polar NRZ schemes.
 This technique is suitable for transmission over AC coupled lines, as signal drooping doesn’t occur here.
 A single error detection capability is present in this.
disadvantages
 No clock is present.
 Long strings of data causes loss of synchronization.

Result:
 Thus various lince coding schemes were implemented and their PSDs were plotted
 Lines codes are simulated and their power spectral density (PSD) are plotted using pwelch command.
 From the PSD plot, we can conclude that Manchester encoded signal occupies twice the bandwidth of
Bipolar NRZ(L) encoded signal.

You might also like