Convolution Calculator

Compute the linear convolution y[n] = (x * h)[n] for two finite-length discrete sequences. Visualize the result, explore properties, and master convolution — fundamental to signal processing, system analysis, and deep learning.

Example: 1, -1, 2 (supports decimals & negatives)
Convolution length = len(x) + len(h) - 1
? Impulse: x=[1,2,3], h=[1] (identity)
? Moving Average: x=[1,1,1,1], h=[0.25,0.25,0.25,0.25]
? Smoothing: x=[1,3,5,4,2], h=[1/3,1/3,1/3]
? Difference: x=[5,4,3,2,1], h=[1,-1]
? Exponential decay: x=[1,2,4,8], h=[0.5,0.5]
? Gaussian approx: x=[1,2,1], h=[1,2,1]
Privacy-first computation: All convolution operations run locally in your browser. No data is sent to any server.

What is Convolution? A Pillar of Signal Processing

Convolution is a mathematical operation that combines two sequences (or functions) to produce a third sequence, expressing how the shape of one is modified by the other. In discrete time, it is defined as \((x * h)[n] = \sum_{k} x[k] \cdot h[n-k]\). It appears everywhere from digital filtering and image edge detection to neural networks (CNNs) and probability theory (sum of independent random variables).

? Convolution theorem (Fourier domain):
$$ \mathcal{F}\{x * h\} = \mathcal{F}\{x\} \cdot \mathcal{F}\{h\} $$

This duality simplifies analysis: convolution in time becomes multiplication in frequency.

Why Use an Interactive Convolution Calculator?

  • Visual & Intuitive: See the resulting sequence as a bar chart, understand how each input sample contributes.
  • Educational Resource: Perfect for DSP courses, lab exercises, and self‑learners verifying hand calculations.
  • Engineering Tool: Rapidly test FIR filter coefficients, compute system responses, and analyze signal interactions.
  • Research & Prototyping: Validate kernel effects before implementing in Python/MATLAB.

Step‑by‑Step Algorithm

Given sequences \(x\) of length \(M\) and \(h\) of length \(N\), the convolution \(y\) has length \(L = M + N - 1\). Each element \(y[i] = \sum_{j=0}^{i} x[j] \cdot h[i-j]\) where indices outside bounds are treated as zero (zero‑padding). This calculator implements the direct O(MN) method — robust for typical classroom and prototyping sequence lengths.

For example, with \(x=[1,1,1], h=[1,1]\): \(y[0]=1*1=1\), \(y[1]=1*1+1*1=2\), \(y[2]=1*1+1*1=2\), \(y[3]=1*1=1\) → result [1,2,2,1]. The bar chart highlights overlapping areas.

Properties of Convolution

  • Commutative: \(x * h = h * x\)
  • Associative: \((x * h) * g = x * (h * g)\)
  • Distributive: \(x * (h + g) = x * h + x * g\)
  • Identity: Impulse sequence \(\delta[n]\): \(x * \delta = x\)
  • Shift invariance: Delaying either input delays output accordingly.

Real‑World Applications

Field Application Example
Audio Engineering Reverberation simulation: convolving dry signal with an impulse response of a hall.
Image Processing Edge detection using Sobel kernels (2D convolution) — our 1D tool is a foundation.
Control Systems Computing output of an LTI system given input and impulse response.
Probability Distribution of sum of two independent discrete random variables: PDF convolution.
Deep Learning Convolutional layers apply learnable kernels to feature maps.
Case Study: Moving Average Smoothing

A financial analyst uses a 3‑point moving average kernel \(h = [1/3, 1/3, 1/3]\) on daily price changes. Convolving price changes with this kernel reduces noise and highlights trends. Using our calculator, you can test any kernel length — a critical tool before live deployment.

Frequently Asked Questions

Linear convolution (computed here) is appropriate for aperiodic finite sequences. Circular convolution wraps around using modulo indexing, typically used with DFT/FFT. Our calculator focuses on linear convolution for general engineering tasks.

Yes, but for performance, lengths up to ~200 elements are recommended. The canvas bar chart displays all points; if result length exceeds 40, bars may become dense. A warning will appear when length > 50, but computation continues normally.

Cross‑correlation is similar but without time‑reversing one sequence. Convolution = correlation with reversed kernel. Both are essential in pattern matching and system identification.

Because each sample of x overlaps with each sample of h, the effective support extends by len(x)+len(h)-1. This captures all non‑zero overlap contributions.

The calculator validates input and shows an error. Ensure you use comma‑separated real numbers (e.g., "1.5, -2, 0"). Empty fields or non‑numeric values trigger warnings.

Trusted Academic & Engineering Reference – This tool implements the standard convolution sum based on Oppenheim & Schafer's “Discrete-Time Signal Processing”. The visualizer uses rigorous scaling to accurately represent amplitudes. All calculations are deterministic and tested against multiple reference implementations. Updated Jun 2026.

References: Wolfram MathWorld – Convolution; A. V. Oppenheim, “Signals and Systems”; Deep Learning Convolution Docs.