0% found this document useful (0 votes)
21 views7 pages

WN - Lab - Report # 05

Wireless Network Lab #05

Uploaded by

Tanveer Khadim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views7 pages

WN - Lab - Report # 05

Wireless Network Lab #05

Uploaded by

Tanveer Khadim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

LAB REPORT # 05

Line Encoding Schemas

SUBMITTED BY:
Tanveer Khadim
16-CP-81
SUBMITTED TO:
Engr. Shahid Ali Bhutta

FEBRUARY 27, 2020


CPED
University of Engineering and Technology, Taxila
Objectives:
The objectives of this lab were to:
 Understand what line coding is
 Why line coding is used
 Write MATLAB code for fundamentals of line coding

Line Coding:
Line coding refers to the process of converting digital data into digital signals. Whenever
we transmit data it is in the form of digital signals, so with the help of line coding, we can
convert a sequence to bits (or encoding) into a digital signal which then again converted into bits
by the receiver (or can be said as decoded by the receiver). For all this to happen we need line
coding schemes which could also be able
to avoid overlapping and distortion of signals.
Some necessary characteristics of line coding schemes:
 Less complexity.
 Should have noise and interference tolerance.
 No DC component (or say low-frequency component) should be there because it can't be
transferred to larger distances.
 Least baseline wandering should be there (baseline wander: low-frequency noise having
nonlinear and non-stationary nature).
 Should have error detection capability.
 Should be self-synchronized.

Types of line coding:


On basis of signal representation following are the major three types of line coding schemas:
 Unipolar
 polar
 Bipolar

Unipolar line coding:


In Unipolar we are simply representing a signal in a graphical form where positive voltage
represents logical or binary 1 and zero voltage represents logical zero. We can say that it's the
simplest line code. The drawback of this scheme is that it is not self-clocking which means that it
can't be decoded without a separate clock signal or any other synchronization source.
Figure 1 Unipolar Signal representation

Polar Line coding:


Unlike unipolar coding in polar coding schema both positive and negative poles are used i.e. 1 is
represented by positive voltage say +5V and 0 is represented by negative voltage level say -5V.
Following are the polar coding schema:

Polar Non-Return to zero (NRZ-L)

Figure 2 Signal representation for polar NRZ-L

Polar Non-Return to zero Inverting (NRZ-I)

Figure 3 Signal representation for polar NRZ-I


Polar Return to zero (RZ)

Figure 4 Signal representation for polar RZ

Task 1 Write a MATLAB code for following line coding schemes.


 Unipolar return to zero
 Polar return to zero
 Manchester encoding

Hint: Use the following bit stream. bits= [1 0 1 0 0 0 1 1 0 1 1 1 0 1 0 0 1]


Assume bitrate of 1 bit per second. Ask the bit duration from the user at run time. Plot the result
as well.

Unipolar Return to zero:


Code:
function [t,x] = unipolarRZ(bits, bitrate)
T = length(bits)/bitrate; % full time of bit sequence
n = input('Enter Signal Duration');
N = n*length(bits);
dt = T/N;
t = 0:dt:T;
x = zeros(1,length(t)); % output signal
for i = 0:length(bits)-1
if bits(i+1) == 1
x(i*n+1:(i+0.5)*n) = 1;
x((i+0.5)*n+1:(i+1)*n) = 0;
else
x(i*n+1:(i+1)*n) = 0;
end
end

Output:
Figure 5 Unipolar return to zero

Polar Return to Zero


Code:
function [t,x] = polarReturnToZero(bits, bitrate)
T = length(bits)/bitrate; % full time of bit sequence
n = input('Enter Signal Duration');
N = n*length(bits);
dt = T/N;
t = 0:dt:T;
x = zeros(1,length(t)); % output signal
for i = 0:length(bits)-1
if bits(i+1) == 1
x(i*n+1:(i+0.5)*n) = 1;
x((i+0.5)*n+1:(i+1)*n) = 0;
else
x(i*n+1:(i+0.5)*n) = -1;
x((i+0.5)*n+1:(i+1)*n) = 0;
end
end
Output:

Figure 6 Polar return to zero

Manchester Encoding:
Code:
function [t,x] = manchester(bits, bitrate)
T = length(bits)/bitrate; % full time of bit sequence
n = input('Enter Signal Duration');
N = n*length(bits);
dt = T/N;
t = 0:dt:T;
x = zeros(1,length(t)); % output signal
for i = 0:length(bits)-1
if bits(i+1) == 1
x(i*n+1:(i+0.5)*n) = 1;
x((i+0.5)*n+1:(i+1)*n) = -1;
else
x(i*n+1:(i+0.5)*n) = -1;
x((i+0.5)*n+1:(i+1)*n) = 1;
end
end

Output:

Figure 7 Manchester encoding

You might also like