Convolution Visualizer, Step by Step

Enter x[n] and h[n], then move the slider. Each step shows h[n − k] under x[k], the products that overlap, and the output sample they add up to.

x[k]
0123-10123kx[k]
h[2 − k], flipped and shifted
00.250.50.751-10123kh[2 − k]

y[2] = 2 × 1 + 3 × 1 = 5

y[n] = x[n] * h[n]
02400.511.522.53ny[n]

y = [1, 3, 5, 3], length 3 + 2 − 1 = 4.

The formulas

y[n]=∑kx[k] h[n−k]y[n] = \sum_{k} x[k]\, h[n - k]

For each n, flip h, shift it by n, multiply sample by sample with x, and add.

length(y)=Nx+Nh−1\text{length}(y) = N_x + N_h - 1

Both sequences start at n = 0 here, so y does too.

Worked example: [1, 2, 3] convolved with [1, 1]

  1. y[0] = 1 × 1 = 1 (only x[0] overlaps h[0]).
  2. y[1] = 1 × 1 + 2 × 1 = 3.
  3. y[2] = 2 × 1 + 3 × 1 = 5.
  4. y[3] = 3 × 1 = 3, so y = [1, 3, 5, 3], with length 3 + 2 − 1 = 4.
  5. h = [1, 1] adds each sample to the one before it: a two-point moving sum.
  • Convolution is commutative: swapping x and h gives the same y.
  • Convolving with a shifted impulse [0, 0, 1] just delays x by two samples.

Sources