---
title: Pulse shaping, bandwidth and intersymbol interference
heading: Why square pulses waste bandwidth, Nyquist's condition for pulses that don't disturb their neighbors at the sampling instants, the raised-cosine family and its roll-off, the bandwidth a symbol rate needs, and the eye closing when a channel smears symbols together
eyebrow: D12 · Lesson 6 · Pulse shaping
xp: 40
---

::: hook
A square pulse is the obvious way to send a symbol, but its sharp edges spread its spectrum far beyond the symbol rate, with sidelobes falling only as 1/f, which wastes a shared channel and splashes into the neighbors. A smoother pulse needs less bandwidth but lasts longer than one symbol, so each pulse overlaps the next. The trick, found by Nyquist in 1928, is to shape the pulse so it passes through zero at every other symbol's sampling instant: the pulses overlap everywhere except at the moments that count.
:::

::: play
- The eye diagram of raised-cosine pulses with roll-off β, through a one-pole channel whose corner is $f_c$ symbol rates, with noise at $E_b/N_0$.
- With a wide channel the eye is open at the center even with β = 0, the narrowest spectrum. Small β gives a narrow eye in time, so timing errors hurt more.
- Lower $f_c$ and each symbol smears into the next: **intersymbol interference** closes the eye.
:::

```sim plot
view: eye
levels: 2
pulse: rc
slider: beta = 0..1 = 0.35 step 0.05
slider: EbN0 = 4..30 = 25 dB step 1
slider: fc = 0.2..2 = 2 step 0.05
rolloff: beta
ebn0: EbN0
channel: fc
```

::: predict
## Raised-cosine pulses with roll-off β = 0.5 carry 1200 symbols per second at baseband. How much bandwidth do they occupy?

- [ ] 600 Hz
- [x] 900 Hz
- [ ] 1200 Hz
- [ ] 1800 Hz

::: reveal
$(1 + \beta)R/2$ = 1.5 × 1200/2 = 900 Hz. The minimum, Nyquist's R/2 = 600 Hz, needs β = 0 and an infinitely long sinc pulse; the roll-off buys pulses that die out quickly in exchange for extra bandwidth. Moved up to a carrier, the spectrum doubles to (1 + β)R = 1800 Hz.
:::
:::

::: nameit
## Nyquist's condition

Symbols $a_k$ sent as $y(t) = \sum_k a_k\,p(t - kT)$ and sampled at $t = nT$ give exactly $a_n$ if

$$p(0) = 1, \qquad p(kT) = 0 \text{ for every other whole } k$$

Then there's no **intersymbol interference** (ISI) at the sampling instants, however much the pulses overlap in between.

## The raised cosine

$$p(t) = \operatorname{sinc}(t/T)\,\frac{\cos(\pi\beta t/T)}{1 - (2\beta t/T)^2}$$

meets Nyquist's condition for any roll-off β from 0 to 1. Its spectrum is flat up to $(1 - \beta)/2T$, rolls off as half a cosine period, and ends at $(1 + \beta)/2T$. At β = 0 it's the sinc pulse, whose tails fall only as 1/t; larger β makes the tails fall as $1/t^3$, so truncating the pulse to a few symbols costs little and timing errors cause less ISI. In practice the shaping is split between a **root-raised-cosine** filter at each end, which together make a raised cosine and also make the receive filter a matched filter.

## Bandwidth

| Signal | Bandwidth |
|---|---|
| Baseband, R symbols/s | $(1 + \beta)R/2$ |
| On a carrier | $(1 + \beta)R$ |
| Rectangular pulses on a carrier | main lobe 2R wide, sidelobes falling as 1/f |

## ISI from the channel

A channel that isn't flat over the signal's band (a cable's roll-off, an echo) reshapes the pulses so they no longer cross zero at the other instants, and the eye closes. Equalizers (lesson 11) undo it.
:::

::: example
## A telephone line passes 300 to 3400 Hz. With β = 0.25, what's the highest symbol rate it can carry on a carrier?

::: solution
1. **Passband width.**
   $$3400 - 300 = 3100\ \text{Hz}$$
2. **Fit the shaped signal.**
   $$\begin{aligned} (1 + \beta)R &\le 3100 \\ R &\le \frac{3100}{1.25} \\ &= 2480 \end{aligned}$$
   symbols per second.
3. **Compare with a real modem.** The V.32 modem standard ran at 2400 baud in this band.

**Answer:** at most 2480 symbols per second.
:::
:::

::: example
## A shaping filter keeps ±6 symbols of the pulse. How big is the pulse 6.5 symbols out for a sinc (β = 0) and a raised cosine with β = 0.35?

::: solution
1. **The sinc tail.**
   $$\begin{aligned} \operatorname{sinc}(6.5) &= \frac{1}{6.5\pi} \\ &= 0.049 \end{aligned}$$
   That's about 5% of the peak, so cutting it off there leaves noticeable ISI.
2. **The raised-cosine tail.** With β = 0.35:
   $$\begin{aligned} p &= 0.049 \times \frac{\cos(2.275\pi)}{1 - 4.55^2} \\ &= -0.0016 \end{aligned}$$
3. **Compare.** That's thirty times smaller, so a 13-symbol filter is plenty.

**Answer:** the sinc is 0.049 of its peak 6.5 symbols out, and the raised cosine only −0.0016.
:::
:::

::: example
## What bandwidth does 1200 baud need on a carrier with raised-cosine pulses of β = 0.5?

::: solution
1. **Bandwidth.**
   $$\begin{aligned} B &= (1 + \beta)R \\ &= 1.5 \times 1200 \\ &= 1800\ \text{Hz} \end{aligned}$$
   centered on the carrier.
2. **Place it in the band.** On a carrier at 1800 Hz it spans 900 to 2700 Hz, safely inside the 300 to 3400 Hz telephone band.

**Answer:** 1800 Hz, which on an 1800 Hz carrier spans 900 to 2700 Hz.
:::
:::

::: check
kind: python

## Make raised-cosine pulses and shape a stream of symbols.

```python starter
import numpy as np

def raised_cosine(t, beta):
    # The raised-cosine pulse at times t (in symbols, a numpy array): sinc(t) times
    # cos(pi*beta*t)/(1 - (2*beta*t)**2). Where the denominator is zero, at t = ±1/(2*beta),
    # use the limit (pi/4)*sinc(1/(2*beta)). np.sinc(x) is sin(pi x)/(pi x).
    return np.zeros_like(t, dtype=float)

def shape(symbols, beta, sps=8, span=6):
    # The sum of symbols[k]*p(t - k), with p the raised cosine cut off beyond ±span symbols,
    # sampled sps times per symbol from t = 0 for len(symbols)*sps samples.
    return np.zeros(len(symbols)*sps)
```

```python solution
import numpy as np

def raised_cosine(t, beta):
    t = np.asarray(t, dtype=float)
    den = 1 - (2*beta*t)**2
    edge = np.abs(den) < 1e-10
    safe = np.where(edge, 1.0, den)
    p = np.sinc(t)*np.cos(np.pi*beta*t)/safe
    if beta > 0:
        p = np.where(edge, np.pi/4*np.sinc(1/(2*beta)), p)
    return p

def shape(symbols, beta, sps=8, span=6):
    n = len(symbols)*sps
    t = np.arange(n)/sps
    y = np.zeros(n)
    for k, a in enumerate(symbols):
        near = np.abs(t - k) <= span
        y[near] += a*raised_cosine(t[near] - k, beta)
    return y
```

```python tests
_t = np.arange(-6, 7, dtype=float)
_p = raised_cosine(_t, 0.35)
assert abs(_p[6] - 1) < 1e-12 and np.max(np.abs(np.delete(_p, 6))) < 1e-12, "The pulse is 1 at t = 0 and exactly 0 at every other whole symbol."
_e = raised_cosine(np.array([1.0, -1.0]), 0.5)
assert np.all(np.isfinite(_e)) and np.allclose(_e, np.pi/4*np.sinc(1.0)), "At t = ±1/(2β) the formula is 0/0; use the limit."
_rng = np.random.default_rng(2)
_s = _rng.choice([-1.0, 1.0], 300)
_y = shape(_s, 0.35)
assert np.allclose(_y[::8], _s, atol=1e-9), "Sampled at the symbol instants, a raised-cosine signal gives back exactly the symbols: no intersymbol interference."
assert np.max(np.abs(_y[4::8] - _s)) > 0.3, "Half a symbol late, the neighbors leak in."
_Y = np.abs(np.fft.rfft(shape(_rng.choice([-1.0, 1.0], 2048), 0.5)))**2
_f = np.fft.rfftfreq(2048*8, 1/8)
assert np.sum(_Y[_f > 0.75])/np.sum(_Y) < 0.01, "With β = 0.5, nearly all the power lies below (1 + β)/2 = 0.75 of the symbol rate."
```

::: right
Right. Your pulses cross zero at every other symbol, so the shaped stream gives back each symbol exactly at its instant, in under 0.75 of the symbol rate.
:::
:::

::: check
given: R = 1200 | 2400 | 9600; b = 0.2 | 0.35 | 0.5
answer: (1 + b)*R/2
unit: Hz
tolerance: 0.5%

## Raised-cosine pulses with roll-off {b} carry {R} symbols per second at baseband. What bandwidth do they occupy?

::: right
Right. $(1 + \beta)R/2$ = {answer} Hz.
:::

::: misses
- [(1 + b)*R] That's on a carrier; at baseband only the positive half counts.
- [R/2] That's the minimum, for β = 0.
- [any] Not yet. Nyquist's minimum plus the roll-off.
:::
:::

::: check
given: B = 3100 | 6000 | 20000; b = 0.15 | 0.25 | 0.35 | 0.5
answer: B/(1 + b)
tolerance: 0.5%

## A channel passes {B} Hz around a carrier. With roll-off {b}, how many symbols per second can it carry?

::: right
Right. $R = B/(1 + \beta)$ = {answer} symbols per second.
:::

::: misses
- [2*B/(1 + b)] On a carrier the signal occupies $(1 + \beta)R$, both sides of the carrier.
- [B] Include the roll-off.
- [any] Not yet. Solve the bandwidth for R.
:::
:::

::: check
given: n = 2 | 5 | 10 | 20
answer: 1/(pi*(n + 0.5))
tolerance: 0.5%

## How big, relative to its peak, is a sinc pulse {n}.5 symbols from its center?

::: right
Right. $|\sin(\pi t)/(\pi t)|$ with sin = ±1 there: {answer}.
:::

::: misses
- [1/(n + 0.5)] Include the π.
- [any] Not yet. The sinc's envelope is $1/\pi t$.
:::
:::

::: check
kind: parts
given: W = 2400 | 3100 | 4000; b = 0.25 | 0.35 | 0.5

## A passband is {W} Hz wide, and pulses use raised-cosine roll-off {b}.

::: part
answer: W/(1 + b)
unit: baud
tolerance: 0.5%

### What is the highest symbol rate it can carry?

::: misses
- [any] $W/(1 + \beta)$.
:::
:::

::: part
answer: W/(1 + b)*2
unit: bit/s
tolerance: 0.5%

### What bit rate does QPSK at that rate give?

::: misses
- [any] Two bits per symbol.
:::
:::
:::

::: check
kind: parts
given: t = 4.5 | 6.5 | 8.5

## A shaping filter is cut off {t} symbols from the pulse's center.

::: part
answer: abs(sin(pi*t)/(pi*t))
tolerance: 1%

### How big is a sinc pulse there?

::: misses
- [any] $|\text{sinc}(t)|$.
:::
:::

::: part
answer: abs(sin(pi*t)/(pi*t)*cos(0.35*pi*t)/(1 - (0.7*t)^2))
tolerance: 1%

### And a raised cosine with β = 0.35?

::: misses
- [any] $\text{sinc}(t)\cos(\pi\beta t)/(1 - 4\beta^2t^2)$.
:::
:::
:::

::: explain
## How can pulses that overlap in time still give no intersymbol interference?

::: model
The receiver only looks at the signal at one instant per symbol, the sampling instant. A Nyquist pulse such as the raised cosine is designed to be exactly zero at every other symbol's sampling instant, even though it's nonzero in between. So when the pulses are added, each sampling instant sees the full value of its own pulse and zero from all the others, however much they overlap at other times. The overlap only matters if the timing is off or the channel distorts the pulse shape, which is why the eye narrows with timing error and closes when the channel smears the pulses.
:::
:::

::: practice

::: check
given: R = 300 | 1e6; b = 0.1 | 1
answer: (1 + b)*R/2
unit: Hz
tolerance: 0.5%

## Baseband bandwidth: {R} symbols/s, β = {b}?

::: misses
- [any] $(1 + \beta)R/2$.
:::
:::

::: check
given: B = 1000 | 1e6; b = 0.05 | 0.22 | 1
answer: B/(1 + b)
tolerance: 0.5%

## Symbol rate in {B} Hz of passband at β = {b}?

::: misses
- [any] $B/(1 + \beta)$.
:::
:::
:::
