Arif DC Lab-Report-02
Arif DC Lab-Report-02
Lab Experiment Name: Implementing encoding and decoding scheme using NRZ-L and NRZ-I,
Implementing encoding and decoding scheme using Manchester and differential Manchester,
Implementing encoding and decoding scheme using AMI and Pseudo ternary
Student Details
Name ID
[For Teachers use only: Don’t Write Anything inside this box]
Signature:.....................
1.TITLE OF THE LAB EXPERIMENT:
Implementing encoding and decoding scheme using NRZ-L and NRZ-I, Implementing encoding and
decoding scheme using Manchester and differential Manchester, Implementing encoding and
decoding scheme using AMI and Pseudo ternary
2.OBJECTIVES:
NRZ-L and NRZ-I Encoding and Decoding:
To comprehend the principles behind Non-Return-to-Zero Level (NRZ-L) and Non-Return-to-Zero
Inverted (NRZ-I) encoding schemes.
To implement NRZ-L and NRZ-I encoding techniques, where binary 1 is represented by a high or
inverted state, respectively, and binary 0 is represented by a low state.
To develop decoding algorithms to retrieve the original bitstream from the encoded signals,
considering the differences in encoding methods between NRZ-L and NRZ-I.
3.IMPLEMENTATION:
Code 1:
% Encoding
for i = 1:length(bits)
if bits(i) == 1
else
end
end
% Decoding
for i = 1:length(t)
counter = counter + 1;
if x(i) ~= lastbit
result(counter) = 1;
lastbit = -lastbit;
else
result(counter) = 0;
end
end
end
disp('NRZ-L Decoding:');
disp(result);
Code 2:
#include <stdio.h>
#include <stdint.h>
int main() {
binaryToDecimalIP(binaryIP);
return 0;
Code 3:
% Implementing Encoding and Decoding Scheme Using Pseudo ternary
bits = [1 0 1 1 1 0 0 1];
% Define parameters
bitrate = 1;
n = 1000;
T = length(bits) / bitrate;
N = n * length(bits);
dt = T / N;
t = 0:dt:T;
x = zeros(1, length(t));
lastbit = 1;
for i = 1:length(bits)
if bits(i) == 1
x((i-1)*n+1:i*n) = -lastbit;
lastbit = -lastbit;
else
x((i-1)*n+1:i*n) = 0;
end
end
ylabel('Amplitude');
% Decoding
counter = 0;
lastbit = 1;
for i = 1:length(t)
counter = counter + 1;
if x(i) == -lastbit
result(counter) = 1;
lastbit = -lastbit;
else
result(counter) = 0;
end
end
end
disp(result);
Output
Output 1:
Output 2:
Output 3:
6.ANALYSIS AND DISCUSSION:
NRZ-L and NRZ-I Encoding and Decoding:
In our exploration, we encountered Non-Return-to-Zero Level (NRZ-L) and Non-Return-to-Zero
Inverted (NRZ-I) encoding schemes. NRZ-L, characterized by fixed voltage levels for 1s and 0s,
offers simplicity but is vulnerable to baseline wander. Conversely, NRZ-I introduces transitions for 1s,
aiding synchronization, yet may pose challenges in sequences devoid of transitions.
7.SUMMARY:
Our laboratory experiment delved into the intricacies of encoding and decoding techniques crucial for
data communication systems. We explored a range of methods including NRZ-L, NRZ-I,
Manchester, Differential Manchester, AMI, and Pseudo Ternary encoding schemes.
NRZ-L and NRZ-I encoding methods represented binary data using fixed voltage levels or
transitions, respectively. Manchester and Differential Manchester encoding introduced transitions for
clock recovery, with Manchester encoding offering robust synchronization but requiring additional
bandwidth. AMI and Pseudo Ternary encoding aimed to minimize the DC component in transmitted
signals, with AMI utilizing alternating voltage levels and Pseudo Ternary encoding focusing on
simplified clock recovery.
Our analysis revealed the trade-offs inherent in each technique, balancing simplicity, synchronization,
bandwidth, and noise immunity. By understanding these nuances, we gained insights into designing
efficient communication systems adaptable to diverse scenarios.