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

Malak Ashour 8125 Sara Walid Elmassry 8236

The document discusses various line coding techniques, including NRZ, RZ, Bipolar, and Manchester coding, highlighting their advantages and disadvantages in terms of synchronization and bandwidth usage. It also covers Power Spectral Density (PSD) characteristics of these signals, noting that Manchester coding requires the highest bandwidth due to frequent transitions. Additionally, the document includes MATLAB code for generating and analyzing these signal types and their PSDs.

Uploaded by

sara.elmassry11
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 views8 pages

Malak Ashour 8125 Sara Walid Elmassry 8236

The document discusses various line coding techniques, including NRZ, RZ, Bipolar, and Manchester coding, highlighting their advantages and disadvantages in terms of synchronization and bandwidth usage. It also covers Power Spectral Density (PSD) characteristics of these signals, noting that Manchester coding requires the highest bandwidth due to frequent transitions. Additionally, the document includes MATLAB code for generating and analyzing these signal types and their PSDs.

Uploaded by

sara.elmassry11
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/ 8

Lab 1

Malak Ashour 8125


Sara walid Elmassry 8236

Comments:

1. Time-Domain Signals
 Each line code has a distinct waveform, affecting synchronization
and bandwidth.
 NRZ (Polar & Inverted): Smooth transitions with minimal
changes, leading to lower bandwidth but potential
synchronization issues.
 RZ (Polar & Bipolar): Signal returns to zero, improving
synchronization but increasing bandwidth usage.
 Manchester: Frequent transitions ensure synchronization but
require the highest bandwidth.

2. Power Spectral Density (PSD)

 NRZ Signals: Have lower frequency components, meaning less


bandwidth usage.
 RZ Signals: Show higher frequency components than NRZ due to
periodic returns to zero.
 Bipolar Codes: Have a reduced DC component, making them more
suitable for long-distance transmission.
 Manchester Coding: Has the broadest spectrum, confirming its high
bandwidth requirement due to frequent transitions.

(1)
Manchester coding has the highest bandwidth because it has a transition in
every bit period, effectively doubling the frequency compared to NRZ and RZ
codes.

(2)
1.Polar NRZ

 Advantages: Simple to implement and uses low bandwidth.


 Disadvantages: Lacks synchronization and has a DC component,
making it unsuitable for AC-coupled transmission.

2.Inverted Polar NRZ

 Advantages: Similar benefits as Polar NRZ but with an inverted signal


for compatibility with certain systems.
 Disadvantages: Has the same issues as Polar NRZ, including lack of
synchronization and a DC component.

3.Polar RZ

 Advantages: Better synchronization than NRZ since each bit returns


to zero.
 Disadvantages: Requires more bandwidth and still has a DC
component.

4.Bipolar NRZ
 Advantages: No DC component, making it ideal for long-distance
transmission. It also allows error detection since consecutive 1s
alternate polarity.
 Disadvantages: Long sequences of 0s can cause synchronization
issues.

5.Bipolar RZ

 Advantages: No DC component and better synchronization than NRZ


because the signal always returns to zero.
 Disadvantages: Requires higher bandwidth than Bipolar NRZ.

6.Manchester

 Advantages: Self-clocking, meaning no separate clock signal is


needed. It also has no DC component, making it suitable for AC
transmission.
 Disadvantages: Requires high bandwidth since each bit has at least
one transition.

(3)
1. Differential Manchester

Differential Manchester is a variation of Manchester coding where the signal


changes based on the previous bit rather than the absolute bit value.

Logic 0: A transition occurs at the start of the bit period.

Logic 1: No transition at the start, but a transition always occurs at


the middle of the bit period.

 Advantage: Resistant to polarity errors, good synchronization.


 Disadvantage: Requires higher bandwidth.

2.4B/5B Encoding
4B/5B encoding is a block coding scheme used in Fast Ethernet
(100BASE-TX). It maps 4-bit data into 5-bit symbols to ensure enough
transitions for synchronization.

 Advantage: Ensures transitions for synchronization, no long 0


sequences.
 Disadvantage: Adds 25% overhead, increasing data rate
requirements.
The matlab code:
%% Generate Random Binary Data

N = 20; % Number of bits

bits = randi([0,1], 1, N); % Random bit sequence

Tb = 1; % Bit duration

ts = Tb/100; % Sampling interval

t = linspace(0, N*Tb, N*100); %time vector

%% Polar Non-Return-to-Zero (NRZ)

polar_nrz = repelem(2*bits-1, 100);

%% Inverted Polar Non-Return-to-Zero (NRZ)

inverted_polar_nrz = -polar_nrz;

%% Polar Return-to-Zero (RZ)

polar_rz = zeros(1, length(bits)*100);

for i = 1:N

polar_rz((i-1)*100+1:(i-1)*100+50) = 2*bits(i)-1;

end

%% Bipolar Non-Return-to-Zero (NRZ) (Alternate Mark Inversion - AMI)

bipolar_nrz = zeros(1, length(bits)*100);

mark = 1;
for i = 1:N

if bits(i) == 1

bipolar_nrz((i-1)*100+1:i*100) = mark;

mark = -mark;

end

end

%% Bipolar Return-to-Zero (RZ)

bipolar_rz = zeros(1, length(bits)*100);

mark = 1;

for i = 1:N

if bits(i) == 1

bipolar_rz((i-1)*100+1:(i-1)*100+50) = mark;

mark = -mark;

end

end

%% Manchester Coding (Biphase-L)

manchester = zeros(1, length(bits) * 100);

for i = 1:N

manchester((i-1)*100+1:(i-1)*100+50) = 2*bits(i)-1; % First half of


bit duration

manchester((i-1)*100+51:i*100) = -(2*bits(i)-1); % Second half of


bit duration
end

%% Compute Power Spectral Density (PSD)

fs = 1/ts; % Sampling frequency

[pxx1, f1] = pwelch(polar_nrz, [], [], [], fs);

[pxx2, f2] = pwelch(inverted_polar_nrz, [], [], [], fs);

[pxx3, f3] = pwelch(polar_rz, [], [], [], fs);

[pxx4, f4] = pwelch(bipolar_rz, [], [], [], fs);

[pxx5, f5] = pwelch(bipolar_nrz, [], [], [], fs);

[pxx6, f6] = pwelch(manchester, [], [], [], fs);

%% Plot Results

figure;

subplot(6,2,1); stairs(t, polar_nrz, 'LineWidth', 2);

title('Polar NRZ'); ylim([-1.5 1.5]); grid on;

subplot(6,2,2); plot(f1, 10*log10(pxx1)); title('PSD - Polar NRZ'); grid


on;

subplot(6,2,3); stairs(t, inverted_polar_nrz, 'LineWidth', 2);

title('Inverted Polar NRZ'); ylim([-1.5 1.5]); grid on;

subplot(6,2,4); plot(f2, 10*log10(pxx2)); title('PSD - Inverted Polar


NRZ'); grid on;
subplot(6,2,5); stairs(t, polar_rz, 'LineWidth', 2);

title('Polar RZ'); ylim([-1.5 1.5]); grid on;

subplot(6,2,6); plot(f3, 10*log10(pxx3)); title('PSD - Polar RZ'); grid on;

subplot(6,2,7); stairs(t, bipolar_rz, 'LineWidth', 2);

title('Bipolar RZ'); ylim([-1.5 1.5]); grid on;

subplot(6,2,8); plot(f4, 10*log10(pxx4)); title('PSD - Bipolar RZ'); grid


on;

subplot(6,2,9); stairs(t, bipolar_nrz, 'LineWidth', 2);

title('Bipolar NRZ'); ylim([-1.5 1.5]); grid on;

subplot(6,2,10); plot(f5, 10*log10(pxx5)); title('PSD - Bipolar NRZ'); grid


on;

subplot(6,2,11); stairs(t, manchester, 'LineWidth', 2);

title('Manchester Coding'); ylim([-1.5 1.5]); grid on;

subplot(6,2,12); plot(f6, 10*log10(pxx6)); title('PSD - Manchester


Coding'); grid on;

You might also like