4.3.3Computer Networks

Physical layer — encoding (NRZ, Manchester), bandwidth, Nyquist, Shannon-Hartley

2,047 words9 min readdifficulty · medium1 backlinks

1. Line Encoding

NRZ (Non-Return-to-Zero)

Manchester Encoding

Figure — Physical layer — encoding (NRZ, Manchester), bandwidth, Nyquist, Shannon-Hartley

2. Bandwidth, Baud, and Bit Rate


3. Nyquist — capacity of a NOISELESS channel


4. Shannon–Hartley — capacity of a NOISY channel


Common Mistakes


Active Recall

Recall Quick self-test (cover the answers)
  • Why does NRZ lose sync on long zero runs? → no transitions → receiver clock drifts.
  • What does Manchester guarantee every bit? → a mid-bit transition (self-clocking).
  • Nyquist formula? → C=2Blog2MC=2B\log_2 M.
  • Shannon formula? → C=Blog2(1+S/N)C=B\log_2(1+S/N).
  • Which limit do you actually use? → the smaller of Nyquist & Shannon.
Recall Feynman: explain to a 12-year-old

Imagine sending secret messages by flicking a flashlight. NRZ = leave it ON for "1", OFF for "0". Problem: if you send ten "0"s, the light is just OFF a long time and your friend can't tell if it was ten zeros or eleven — they lose count. Manchester = you always blink in the middle of every letter, so your friend's "tick-tock" stays in step. The blinking costs you twice as fast flicking (more "bandwidth"), but no one loses count. Nyquist says: a flashlight can only blink so fast before blinks blur together. Shannon adds: if the room is foggy (noise), bright-vs-dim levels blur, so you can't use too many brightness levels — that sets the true top speed.


Connections

  • Data Link Layer — uses framing on top of these encoded bits
  • Modulation (ASK, FSK, PSK, QAM) — how MM levels are physically realized
  • Signal-to-Noise Ratio — the S/NS/N inside Shannon
  • Sampling Theorem — the root of the 2B2B factor in Nyquist
  • Bandwidth vs Bit Rate — baud/level relationship
What does line encoding map between?
Data bits ↔ time-varying voltage/signal patterns
In NRZ-L, what represents a 1 and a 0?
High voltage = 1, low voltage = 0 (level held for whole bit)
Why does NRZ struggle with long runs of identical bits?
No transitions occur, so the receiver clock drifts and loses bit-count synchronization
What transition does Manchester guarantee, and why?
A mid-bit transition every bit — makes it self-clocking
What is the main cost of Manchester vs NRZ?
It needs about double the bandwidth (up to 2 transitions per bit)
Bit rate vs baud rate relationship?
bit rate = baud × log₂ M, where M = number of signal levels
State the Nyquist capacity formula.
C = 2B·log₂ M (bits/s), noiseless channel
Why is the Nyquist symbol rate 2B?
A bandwidth-B signal is fully represented by 2B samples/sec (sampling theorem)
State the Shannon–Hartley formula.
C = B·log₂(1 + S/N) bits/s for a noisy channel
Why must SNR be linear (not dB) in Shannon?
The formula uses the actual power ratio; convert via S/N = 10^(dB/10)
Convert 30 dB SNR to a linear ratio.
10^(30/10) = 1000
Which capacity do you use when both apply?
The smaller of Nyquist and Shannon (Shannon is the absolute noisy-channel ceiling)
Roughly how many levels does noise permit (Shannon intuition)?
M ≈ √(1 + S/N)
Channel B=3000Hz, M=4: Nyquist capacity?
C = 2·3000·log₂4 = 12000 bits/s

Concept Map

encoded into

maps bits to

simplest form

self-clocking

long runs cause

edge every bit gives

costs

frequency range Hz

times log2 M

Nyquist noiseless

Shannon-Hartley

bounds

Bits 1s and 0s

Signals voltage vs time

Line encoding rule

NRZ-L level = bit

Manchester mid-bit transition

Sync loss + DC component

Clock recovery no DC

Double bandwidth vs NRZ

Channel capacity limit

Baud symbols/sec

Bit rate bits/sec

Noise SNR

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Physical layer ka kaam simple hai: tumhare bits (0 aur 1) ko wire/air pe ek signal (voltage ya wave) bana ke bhejna. Pehla sawaal — bit ko draw kaise karein? NRZ me 1 matlab high voltage, 0 matlab low, aur signal poore bit ke liye wahi level hold karta hai. Sasta hai par problem ye ki agar 00000 jaisa lamba run aaya to flat line ban jati hai, receiver ka clock drift ho jata hai aur count gum ho jata hai. Manchester isko fix karta hai — har bit ke beech (mid-bit) ek transition guaranteed hota hai, isse receiver har bit pe clock re-sync kar leta hai (self-clocking). Cost? Double bandwidth chahiye, kyunki ek bit me 2 tak transitions ho sakte hain.

Doosra sawaal — channel kitne bits/sec utha sakta hai? Nyquist noiseless channel ke liye: C=2Blog2MC=2B\log_2 M. Yahan 2B2B matlab bandwidth BB se max 2B2B symbols/sec bhej sakte ho, aur har symbol log2M\log_2 M bits carry karta hai (kyunki MM levels = log2M\log_2 M bits). Agar levels badhao to per-symbol zyada bits — par real life me noise problem create karta hai.

Shannon–Hartley real (noisy) channel ka asli ceiling deta hai: C=Blog2(1+S/N)C=B\log_2(1+S/N). Idea ye hai ki noise decide karta hai kitne levels reliably distinguish ho sakte hain (M1+S/NM\approx\sqrt{1+S/N}), isi ko Nyquist me daal do to Shannon nikal aata hai. Ek bada exam trap: SNR agar dB me diya hai (jaise 30 dB), to pehle linear banao — 1030/10=100010^{30/10}=1000 — phir formula me daalo. Aur jab dono limits available ho, hamesha chhoti wali value use karo, kyunki Shannon ko cross karna physically impossible hai.

Go deeper — visual, from zero

Test yourself — Computer Networks

Connections