Your Equation

Library / Signal processing and digital filters / DSP-22

Signal processing and digital filters

Circular convolution at a specified sample

One sample of the circular convolution of two periodic vectors of equal length N (up to 6), with the input index wrapping at both ends.

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

For two periodic sequences of length N, circular convolution wraps the input index: y[n] = Σ h[j]x[(n − j) mod N]. Multiplying the N-point DFTs of the two vectors and inverting gives exactly this, not the linear convolution, unless both are zero-padded to at least len(x) + len(h) − 1.

One sample of the circular convolution of two periodic vectors of equal length N (up to 6), with the input index wrapping at both ends. Multiplying the unpadded N-point DFTs of the two sequences produces exactly this convolution.

Calculator

Solve for
V
samples
16
05
V
−1010
V
−1010
V
−1010
V
−1010
V
−1010
V
−1010
−22
−22
−22
−22
−22
−22
  • Sum of the taps, Σh0.5
  • Sum of the inputs, Σx7 V
  • Sum of all N 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.

Circular convolution output (V) current value −1 V
x0Input sample 0Key driver
−128
h1Filter tap 1
−79
x2Input sample 2
−46
h2Filter tap 2
−53
nOutput index
3
h0Filter tap 0
−40
NPeriod
1
x1Input sample 1
x3Input sample 3
x4Input sample 4
x5Input sample 5
h3Filter tap 3
h4Filter tap 4
h5Filter tap 5
  • The circular output at index 0 is −1 V.
  • The linear convolution of the same vectors would differ at the start, where the circular form pulls in samples from the far end; pad with zeros to avoid this in FFT filtering.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing (V)Local stepChange in result
x0 Input sample 0−10 to 10 V−12820+0.4 V−40 %
h1 Filter tap 1−2 to 2 −7916+0.08 −32 %
x2 Input sample 2−10 to 10 V−4610+0.4 V+20 %
h2 Filter tap 2−2 to 2 −538+0.08 −16 %
n Output index0 to 5 −134+1 −250 %
h0 Filter tap 0−2 to 2 −404+0.08 −8 %
N Period1 to 6 samples−112+1 samples−200 %
x1 Input sample 1−10 to 10 V−1−10+0.4 V0 %
x3 Input sample 3−10 to 10 V−1−10+0.4 V0 %
x4 Input sample 4−10 to 10 V−1−10+0.4 V0 %
x5 Input sample 5−10 to 10 V−1−10+0.4 V0 %
h3 Filter tap 3−2 to 2 −1−10+0.08 0 %
h4 Filter tap 4−2 to 2 −1−10+0.08 0 %
h5 Filter tap 5−2 to 2 −1−10+0.08 0 %

Sweep of Output index

Output indexCircular convolution output (V)
0−1
0.6251.5
1.251.5
1.8753
2.5−1
3.125−1
3.751.5
4.3751.5
53

Sweep one variable

Circular convolution output (V)Hover, touch, or use the arrow keys on the chart
−10123 012345 Output index now −1

Variables and how each one contributes

y[n]

Circular convolution output

Result · V

What the equation gives you. Everything else feeds it.

N

Period

samples · typical 1 to 6

The period, up to 6 here. Sets where the index wraps around. Raising it by 10 % (to 3.3) moves the result by +0 %, from −1 to −1 V.

n

Output index

· typical 0 to 5

The output index. Selects the output sample. Raising it by 10 % (to 0) moves the result by +0 %, from −1 to −1 V.

x0

Input sample 0

V · typical −10 to 10

The input sample x[0], in V (ignored if 0 ≥ N). Is multiplied by one tap, chosen by wrapping n − j. Raising it by 10 % (to 1.1) moves the result by −10 %, from −1 to −0.9 V.

x1

Input sample 1

V · typical −10 to 10

The input sample x[1], in V (ignored if 1 ≥ N). Is multiplied by one tap, chosen by wrapping n − j. Raising it by 10 % (to 2.2) moves the result by +0 %, from −1 to −1 V.

x2

Input sample 2

V · typical −10 to 10

The input sample x[2], in V (ignored if 2 ≥ N). Is multiplied by one tap, chosen by wrapping n − j. Raising it by 10 % (to 4.4) moves the result by +20 %, from −1 to −1.2 V.

x3

Input sample 3

V · typical −10 to 10

The input sample x[3], in V (ignored if 3 ≥ N). Is multiplied by one tap, chosen by wrapping n − j. Raising it by 10 % (to 0) moves the result by +0 %, from −1 to −1 V.

x4

Input sample 4

V · typical −10 to 10

The input sample x[4], in V (ignored if 4 ≥ N). Is multiplied by one tap, chosen by wrapping n − j. Raising it by 10 % (to 0) moves the result by +0 %, from −1 to −1 V.

x5

Input sample 5

V · typical −10 to 10

The input sample x[5], in V (ignored if 5 ≥ N). Is multiplied by one tap, chosen by wrapping n − j. Raising it by 10 % (to 0) moves the result by +0 %, from −1 to −1 V.

h0

Filter tap 0

· typical −2 to 2

The filter tap h[0] (ignored if 0 ≥ N). Weights the input sample x[(n − 0) mod N]. Raising it by 10 % (to 1.1) moves the result by −10 %, from −1 to −0.9 V.

h1

Filter tap 1

· typical −2 to 2

The filter tap h[1] (ignored if 1 ≥ N). Weights the input sample x[(n − 1) mod N]. Raising it by 10 % (to −0.55) moves the result by +20 %, from −1 to −1.2 V.

h2

Filter tap 2

· typical −2 to 2

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

h3

Filter tap 3

· typical −2 to 2

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

h4

Filter tap 4

· typical −2 to 2

The filter tap h[4] (ignored if 4 ≥ N). Weights the input sample x[(n − 4) mod N]. Raising it by 10 % (to 0) moves the result by +0 %, from −1 to −1 V.

h5

Filter tap 5

· typical −2 to 2

The filter tap h[5] (ignored if 5 ≥ N). Weights the input sample x[(n − 5) mod N]. Raising it by 10 % (to 0) moves the result by +0 %, from −1 to −1 V.

Worked example with the values above

  1. Wrapped indices: (n − j) mod 3 for j = 0 to 2.
  2. Terms: h[0]·x[0] = 1 × 1; h[1]·x[2] = −0.5 × 4; h[2]·x[1] = 0 × 2.
  3. y[0] = −1 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