Your Equation

Library / Signal processing and digital filters / DSP-21

Signal processing and digital filters

Linear convolution at a specified sample

One sample n of the full linear convolution of an input x (up to 6 samples) with a filter h (up to 4 taps), both indexed from zero and taken as zero outside their stored values.

Ref
DSP-21
Rev
v1
Field
Signal processing and digital filters
Result
y[n] [V]

One sample of the linear convolution of x with a filter h is y[n] = Σ h[j]x[n − j]: the current and past inputs weighted by the taps. Samples outside either stored vector count as zero. The full convolution has len(x) + len(h) − 1 samples, so n runs from 0 to len(x) + len(h) − 2.

One sample n of the full linear convolution of an input x (up to 6 samples) with a filter h (up to 4 taps), both indexed from zero and taken as zero outside their stored values. Leave unused entries at zero. Valid for 0 ≤ n ≤ len(x) + len(h) − 2.

Calculator

Solve for
V
08
V
−1010
V
−1010
V
−1010
V
−1010
V
−1010
V
−1010
−22
−22
−22
−22
  • Sum of the taps, Σh (the DC gain)0.5
  • Sum of the inputs, Σx7 V
  • Sum of all outputs, Σh × Σx3.5 V

What drives the result

Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.

Convolution output (V) current value 3 V
x2Input sample 2Key driver
−119
h0Filter tap 0
−97
x1Input sample 1
−19
h1Filter tap 1
08
nOutput index
−2
h2Filter tap 2
15
x0Input sample 0
x3Input sample 3
x4Input sample 4
x5Input sample 5
h3Filter tap 3
  • Output sample 2 is 3 V.
  • The sum of all output samples is always the sum of the taps times the sum of the inputs, here 3.5 V, a quick check on a convolution routine.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing (V)Local stepChange in result
x2 Input sample 2−10 to 10 V−11920+0.4 V+13.3 %
h0 Filter tap 0−2 to 2 −9716+0.08 +10.7 %
x1 Input sample 1−10 to 10 V−1910+0.4 V−6.67 %
h1 Filter tap 1−2 to 2 088+0.08 +5.33 %
n Output index0 to 8 −235+1 −167 %
h2 Filter tap 2−2 to 2 154+0.08 +2.67 %
x0 Input sample 0−10 to 10 V330+0.4 V0 %
x3 Input sample 3−10 to 10 V330+0.4 V0 %
x4 Input sample 4−10 to 10 V330+0.4 V0 %
x5 Input sample 5−10 to 10 V330+0.4 V0 %
h3 Filter tap 3−2 to 2 330+0.08 0 %

Sweep of Output index

Output indexConvolution output (V)
01
11.5
23
3−2
40
50
60
70
80

Sweep one variable

Convolution output (V)Hover, touch, or use the arrow keys on the chart
−2−10123 02468 Output index now 3

Variables and how each one contributes

y[n]

Convolution output

Result · V

What the equation gives you. Everything else feeds it.

n

Output index

· typical 0 to 8

The output index. Selects which output sample is computed; it picks different pairs of input and tap. Raising it by 10 % (to 2.2) moves the result by +0 %, from 3 to 3 V.

x0

Input sample 0

V · typical −10 to 10

The input sample x[0], in V. Is multiplied by tap h[n − 0] if that index exists. Raising it by 10 % (to 1.1) moves the result by +0 %, from 3 to 3 V.

x1

Input sample 1

V · typical −10 to 10

The input sample x[1], in V. Is multiplied by tap h[n − 1] if that index exists. Raising it by 10 % (to 2.2) moves the result by −3.33 %, from 3 to 2.9 V.

x2

Input sample 2

V · typical −10 to 10

The input sample x[2], in V. Is multiplied by tap h[n − 2] if that index exists. Raising it by 10 % (to 4.4) moves the result by +13.3 %, from 3 to 3.4 V.

x3

Input sample 3

V · typical −10 to 10

The input sample x[3], in V. Is multiplied by tap h[n − 3] if that index exists. Raising it by 10 % (to 0) moves the result by +0 %, from 3 to 3 V.

x4

Input sample 4

V · typical −10 to 10

The input sample x[4], in V. Is multiplied by tap h[n − 4] if that index exists. Raising it by 10 % (to 0) moves the result by +0 %, from 3 to 3 V.

x5

Input sample 5

V · typical −10 to 10

The input sample x[5], in V. Is multiplied by tap h[n − 5] if that index exists. Raising it by 10 % (to 0) moves the result by +0 %, from 3 to 3 V.

h0

Filter tap 0

· typical −2 to 2

The filter tap h[0]. Weights the input sample x[n − 0]. Raising it by 10 % (to 1.1) moves the result by +13.3 %, from 3 to 3.4 V.

h1

Filter tap 1

· typical −2 to 2

The filter tap h[1]. Weights the input sample x[n − 1]. Raising it by 10 % (to −0.55) moves the result by −3.33 %, from 3 to 2.9 V.

h2

Filter tap 2

· typical −2 to 2

The filter tap h[2]. Weights the input sample x[n − 2]. Raising it by 10 % (to 0) moves the result by +0 %, from 3 to 3 V.

h3

Filter tap 3

· typical −2 to 2

The filter tap h[3]. Weights the input sample x[n − 3]. Raising it by 10 % (to 0) moves the result by +0 %, from 3 to 3 V.

Worked example with the values above

  1. Index pairs with j + (n − j) = 2, kept when both exist.
  2. Terms: h[0]·x[2] = 1 × 4 = 4; h[1]·x[1] = −0.5 × 2 = −1; h[2]·x[0] = 0 × 1 = 0.
  3. y[2] = 3 V.

Assumptions and limits

  • Finite real sequences indexed from zero and taken as zero outside their stored length.
  • Equally spaced samples, and for the circular forms, periodic extension of both sequences.

Common mistakes

  • Mixing up the linear and circular forms when an FFT is used.
  • Reversing the lag convention for correlation.
  • Dividing by N − ℓ where the biased form divides by N.

Statistics and uncertainty

Convolution and correlation sums are exact, so errors come from the data; a delay found from a correlation peak is limited to the sampling interval unless interpolated, and finite records bias the autocovariance by a factor of (N − ℓ)/N.

Where it is used

  • Computing filter outputs, delays and covariance by hand for checks.
  • Choosing block sizes for fast FFT-based filtering.

Maths you need

  • Linear convolution: y[n] = Σ h[j] x[n − j]
  • Circular convolution: the same sum with indices wrapped modulo N
  • Correlation: a sliding product that measures similarity at each lag

Related formulas

Practise this formula