S852 of 56
0 XP
  1. Hook
  2. Predict
  3. Name it
  4. Check
  5. Explain

S8 · Lesson 52 · Modem lab

Building a complete QPSK modem with root-raised-cosine pulse shaping, a matched-filter receiver and an AWGN channel calibrated in Eb/N0, and measuring its bit error rate against theory

The first half of this course derived the pieces of a digital link one formula at a time: pulse shaping, matched filtering, the AWGN channel, error probability. In this lab you'll assemble them into a working QPSK modem and check it the way a communications engineer would, by sending tens of thousands of random bits through simulated noise and counting errors. If every scale factor is right, the measured bit error rate lands on Q(2Eb/N0); if one is wrong, the curve shifts by decibels and the test tells you.

Predict

The transmitter and receiver each use a root-raised-cosine filter. Why does the cascade cause no intersymbol interference at the sampling instants?

Name it

The root raised cosine

With t in symbol periods and rolloff β:

h(t)=sin⁡πt(1−β)+4βtcos⁡πt(1+β)πt[1−(4βt)2]

with the limits h(0)=1−β+4βπ and h(±14β)=β2[(1+2π)sin⁡π4β+(1−2π)cos⁡π4β]. Sampled at sps samples per symbol over ±span symbols and scaled to unit energy.

The link

  • Modulator: bits in pairs → (1−2b0)+j(1−2b1)2 (Gray-coded, unit energy), one symbol every sps samples, filtered by h.
  • Channel: complex white Gaussian noise. With unit-energy symbols and pulses, the energy per symbol is 1 in sample units, so N0=1/(Es/N0)=1/(2Eb/N0) is the complex noise variance per sample, N0/2 in each of the real and imaginary parts.
  • Demodulator: filter by h again, sample every sps samples starting at the combined delay, len(h) − 1, and decide each bit by a sign.

Expected: Pb=Q(2Eb/N0), 2.4 × 10⁻³ at 6 dB and 1.25 × 10⁻² at 4 dB.

Worked example

How many bits must be simulated to measure a 10⁻³ error rate to about ±20%?

Show the solution
  1. Spread of an error count. Error counts are roughly Poisson, so the relative spread is 1nerrors
  2. Errors needed. ±20% needs about 25 errors: 125=20%
  3. Bits needed. At 10⁻³ that's about 2510−3=25000bits
  4. The lab's runs. Its 40,000-bit runs at 4 and 6 dB collect roughly 500 and 100 errors, enough to land within the tests' 20 to 25% windows.

Answer about 25,000 bits.

Worked example

At Eb/N0 = 3 dB, what noise variance should the channel add?

Show the solution
  1. Linear Eb/N0. 100.3=1.995
  2. Per symbol. Es/N0=3.99
  3. Noise density. N0=1/3.99=0.2506 per complex sample.
  4. Per component. 0.2506/2=0.354 That's the standard deviation in each of the real and imaginary parts.

Answer N0 = 0.2506 per complex sample: a standard deviation of 0.354 in each of the real and imaginary parts.

Check

Step 1. Write rrc(beta, span, sps): unit-energy root-raised-cosine taps.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Step 2. Write qpsk_mod and qpsk_demod: Gray-coded QPSK with pulse shaping and a matched-filter receiver.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Step 3. Write awgn(x, ebn0_db, sps, rng): complex noise scaled to a given Eb/N0.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why does the modem sample at delay len(h) − 1?

Practice

Keep practicing

3 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.