WN - Lab - Report # 05
WN - Lab - Report # 05
SUBMITTED BY:
Tanveer Khadim
16-CP-81
SUBMITTED TO:
Engr. Shahid Ali Bhutta
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.
Output:
Figure 5 Unipolar 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: