Don Stephenson Don Stephenson

Convolution

Slide a kernel across a signal, multiply, and sum

One operation sits underneath every digital filter, audio effect, image blur, and convolutional neural network: y[n] = Σ k[m]·x[n−m]. Turn the crank yourself in the machine, design your own kernel in the lab, then see where the same sliding sum shows up in DSP, imaging, and CNNs.

A discrete signal is just a list of numbers sampled over time — microphone voltages, stock prices, pixel rows. Convolution combines that signal x[n] with a short list of weights called a kernel (or impulse response), k[m].

y[n] = Σm k[m] · x[n − m]

Read it as a recipe. To compute one output sample y[n]: center the kernel over position n of the input, multiply each kernel weight by the input sample beneath it, and add the products. Then shift one sample to the right and repeat. That is the whole operation.

Why engineers care

The kernel is the filter. Change five numbers and the very same sliding-window machinery becomes a noise smoother, a bass-cut, an echo, or an edge detector. Any linear, time-invariant system — an amplifier, a room's acoustics, a communication channel — is completely described by one kernel: its response to a single unit spike.

Linearity

Convolving a sum of signals equals the sum of the convolutions. Filters treat every component of a signal the same way.

Shift invariance

Delay the input and the output delays by the same amount. The filter behaves identically at every moment in time.

Commutativity

x ∗ k = k ∗ x. Signal and kernel are interchangeable — a fact with surprisingly deep consequences.

Related transforms you may have met — Fourier, Laplace, Z — are ways of analyzing what a kernel does; convolution is the operation they analyze. In fact, convolution in time equals multiplication in frequency, which is why the two subjects are always taught together.

Below is a noisy test signal — two sine waves, random noise, and a sudden bump near n = 40. Choose a kernel, then drag the position slider (or press animate) and watch each output sample get assembled as a weighted sum of the highlighted input samples.

Sliding-window assembly

Step the kernel across the input, one sample at a time, and watch the output build up.

Signal scope — Ch A input x[n] with kernel window  ·  Ch B output y[n]
input x[n]
kernel taps × weights — colored by tap
output y[n]
Kernel weights
Current sum

What to look for

With the moving average, the jagged noise flattens but the bump's corners round off — smoothing always trades sharpness for calm. The Gaussian keeps more of the shape because it trusts the center sample most. The edge detector ignores everything flat and fires only where the signal jumps: opposite-signed weights cancel on constant stretches.

Now take the controls. Set the five weights yourself, pick a test signal, and the full output is computed instantly. Two readouts matter: the sum of weights is the filter's DC gain — what it does to a constant signal — and the impulse test signal reveals the kernel itself, mirrored, sitting in the output.

Kernel lab

Design a 5-tap kernel and watch the full convolution update live.

Σ weights (DC gain)
1.00
Ch A input  ·  Ch B output (full convolution)
input
output

Experiments to try

Read the impulse response

Select the impulse signal. The output traces your kernel weights exactly — proof that a spike "reads out" any linear filter.

Break the DC gain

Set all weights to 0.4 and feed in the step. The plateau lands at 2.0, not 1.0 — the filter amplifies constants when weights sum past one.

Build a sharpener

Load the sharpen preset on the square wave. A positive center flanked by negatives exaggerates transitions — the trick behind image sharpening.

Where the machine shows up

Equalizers and reverb

An EQ band is a carefully designed kernel; convolution reverb records a real room's impulse response and convolves your dry track with it.

Blur, sharpen, detect

Every photo filter is a 2-D kernel slid over pixels. Gaussian blur, unsharp mask, and Sobel edge detection are the three you just built, in two dimensions.

Convolutional networks

A CNN layer is thousands of small kernels whose weights are learned from data instead of designed by hand — the sliding sum is identical.

Channels and matched filters

A radio channel convolves your transmitted signal with its own impulse response; receivers convolve again with a matched kernel to undo it.

Sums of random variables

Add two independent random variables and their probability distributions convolve — the reason repeated averaging tends toward the bell curve.

Sensor deblurring

Instruments smear reality with their own response kernel. Knowing it lets you deconvolve — computationally sharpening telescope and microscope data.

Self-check

1. A kernel's weights sum to zero. Fed a long constant signal, the output is…

2. Convolving any signal with a single unit impulse kernel […0, 1, 0…] produces…

3. Making a smoothing kernel longer (more equal weights) mainly…

Answer every question before checking.

DRAG THE POSITION SLIDER TO STEP THROUGH THE MACHINE · SET WEIGHTS IN THE KERNEL LAB
PROJECT: LIGHTSTRUC AISHEET: TOOLS · CONVOLUTIONSOURCE: convolution.htmlREV 1.0