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
- 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.
- 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
| Variable | Typical range | Lowest result | Highest result | Swing (V) | Local step | Change in result |
|---|---|---|---|---|---|---|
| x0 Input sample 0 | −10 to 10 V | −12 | 8 | 20 | +0.4 V | −40 % |
| h1 Filter tap 1 | −2 to 2 | −7 | 9 | 16 | +0.08 | −32 % |
| x2 Input sample 2 | −10 to 10 V | −4 | 6 | 10 | +0.4 V | +20 % |
| h2 Filter tap 2 | −2 to 2 | −5 | 3 | 8 | +0.08 | −16 % |
| n Output index | 0 to 5 | −1 | 3 | 4 | +1 | −250 % |
| h0 Filter tap 0 | −2 to 2 | −4 | 0 | 4 | +0.08 | −8 % |
| N Period | 1 to 6 samples | −1 | 1 | 2 | +1 samples | −200 % |
| x1 Input sample 1 | −10 to 10 V | −1 | −1 | 0 | +0.4 V | 0 % |
| x3 Input sample 3 | −10 to 10 V | −1 | −1 | 0 | +0.4 V | 0 % |
| x4 Input sample 4 | −10 to 10 V | −1 | −1 | 0 | +0.4 V | 0 % |
| x5 Input sample 5 | −10 to 10 V | −1 | −1 | 0 | +0.4 V | 0 % |
| h3 Filter tap 3 | −2 to 2 | −1 | −1 | 0 | +0.08 | 0 % |
| h4 Filter tap 4 | −2 to 2 | −1 | −1 | 0 | +0.08 | 0 % |
| h5 Filter tap 5 | −2 to 2 | −1 | −1 | 0 | +0.08 | 0 % |
Sweep of Output index
| Output index | Circular convolution output (V) |
|---|---|
| 0 | −1 |
| 0.625 | 1.5 |
| 1.25 | 1.5 |
| 1.875 | 3 |
| 2.5 | −1 |
| 3.125 | −1 |
| 3.75 | 1.5 |
| 4.375 | 1.5 |
| 5 | 3 |
Sweep one variable
Variables and how each one contributes
Circular convolution output
What the equation gives you. Everything else feeds it.
Period
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.
Output index
The output index. Selects the output sample. Raising it by 10 % (to 0) moves the result by +0 %, from −1 to −1 V.
Input sample 0
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.
Input sample 1
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.
Input sample 2
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.
Input sample 3
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.
Input sample 4
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.
Input sample 5
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.
Filter tap 0
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.
Filter tap 1
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.
Filter tap 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.
Filter tap 3
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.
Filter tap 4
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.
Filter tap 5
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
- Wrapped indices: (n − j) mod 3 for j = 0 to 2.
- Terms: h[0]·x[0] = 1 × 1; h[1]·x[2] = −0.5 × 4; h[2]·x[1] = 0 × 2.
- 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