Bits become pulses
We want to send eight bits, 1 0 1 1 0 0 1 0, at 1000 bits per second. One bit leaves every T = 1 ms, the symbol time. A wire cannot carry numbers; it carries a voltage that changes over time.
First each bit becomes a number: 1 → +1 V and 0 → −1 V. This is polar signalling, from the line coding lesson. Picture each number a_k as a thin spike at its own time t = kT.
A pulse-shaping filter replaces each spike with one fixed pulse p(t), scaled by a_k and centred at kT. Adding all the copies gives the signal on the wire: s(t) = Σ a_k·p(t − kT).
The rectangle and its spectrum
The simplest pulse is a rectangle one symbol wide: p(t) = 1 for |t| < T/2. The copies sit edge to edge and make the familiar NRZ square wave. Its sudden jumps are the problem, as its spectrum shows.
For random bits the power spectrum is S(f) = T·sinc²(fT). It is zero at 1, 2, 3 kHz but never ends: 90.3% of the power lies below 1 kHz, and keeping 99% takes about 10.3 kHz.
Narrower spectra
The sinc pulse p(t) = sinc(t/T) has a flat spectrum up to 1/(2T) = 500 Hz and none above. Nothing narrower can carry 1000 symbols a second without them interfering. The cost: in time it never ends, and its tails shrink only like 1/t.
The raised-cosine pulse rounds off the spectrum's edge, here with roll-off β = 0.35. It uses (1 + β)/(2T) = 675 Hz, 35% more than sinc, but its tails shrink like 1/t³, so a short filter can make it.
Same bits, three pulses. The rectangle needs about 1 kHz for 90% and leaks forever; raised cosine needs 675 Hz, sinc 500 Hz. Short, sharp pulses spread in frequency; smooth, long pulses stay narrow.
Getting the bits back
The receiver reads s(t) once per symbol, at t = kT. Each raised-cosine copy is zero at every other symbol's time, so s(kT) = a_k exactly. The sign gives each bit back: 1 0 1 1 0 0 1 0.
In Python with numpy: make the ±1 symbols, place them 16 samples apart in an array of zeros, and convolve with raised-cosine taps p. Every 16th output sample is a symbol again.
The working
# step 1/10 · bits bits 1 0 1 1 0 0 1 0 rate R = 1000 bit/s symbol T = 1 / R = 1 ms the job of this lesson: bits -> a voltage s(t) on the wire and how much bandwidth s(t) takes
The bits, the rate of 1000 bit/s and the roll-off β = 0.35 are a chosen example; every curve and number in the figure is computed from this model (sums of the actual pulses, and the spectra from their Fourier transforms). The spectrum plot is the power spectral density for a long run of independent, equally likely bits, S(f) = |P(f)|²/T, not the spectrum of these eight bits alone. It is drawn for f ≥ 0; it is the same for negative f.