Convolution Calculator

Enter two finite sequences to get their discrete convolution, with every output sample written out as its sum of products. Switch to circular convolution for a chosen period N.

x[n] ∗ h[n]0, 1, 2.5, 4, 1.5

Numbers separated by commas or spaces, up to 200 values.

Numbers separated by commas or spaces, up to 200 values.

n

Use a negative index for samples before n = 0.

n

-1000000 – 1000000

x[n] ∗ h[n]

0, 1, 2.5, 4, 1.5

  • Output length5.0000
  • Output index rangen = 0 … 4
  • Sum of outputs9.0000000000
Sum of products for each output index
nTermsProductsy[n]
0x[0]·h[0]1×00
1x[0]·h[1] + x[1]·h[0]1×1 + 2×01
2x[0]·h[2] + x[1]·h[1] + x[2]·h[0]1×0.5 + 2×1 + 3×02.5
3x[1]·h[2] + x[2]·h[1]2×0.5 + 3×14
4x[2]·h[2]3×0.51.5

Finite sequences are treated as zero outside the entered samples. The sum of the output always equals (sum of x) × (sum of h), a quick check.

How this was calculated

Linear convolution: y[n] = Σₖ x[k] · h[n − k]. Length = 3 + 3 − 1 = 5; first index = 0 + 0 = 0.

y[0] = x[0]·h[0] = 1×0 = 0

y[1] = x[0]·h[1] + x[1]·h[0] = 1×1 + 2×0 = 1

y[2] = x[0]·h[2] + x[1]·h[1] + x[2]·h[0] = 1×0.5 + 2×1 + 3×0 = 2.5

y[3] = x[1]·h[2] + x[2]·h[1] = 2×0.5 + 3×1 = 4

y[4] = x[2]·h[2] = 3×0.5 = 1.5

The convolution formula

The discrete convolution of x[n] and h[n] is y[n] = Σ x[k] · h[n − k], summed over every k where both samples exist. Samples outside the entered values count as zero.

If x has Nx samples and h has Nh samples, the result has Nx + Nh − 1 samples. When x starts at index nx₀ and h at nh₀, the first output index is nx₀ + nh₀.

Circular convolution with period N wraps the index instead: y[n] = Σ x[k] · h[(n − k) mod N] for n = 0 … N − 1. It is what multiplying two N-point discrete Fourier transforms computes, and it matches linear convolution only when N ≥ Nx + Nh − 1.

Worked example

Take x = [1, 2, 3] and h = [0, 1, 0.5]. The output has 3 + 3 − 1 = 5 samples.

y[0] = 1×0 = 0; y[1] = 1×1 + 2×0 = 1; y[2] = 1×0.5 + 2×1 + 3×0 = 2.5; y[3] = 2×0.5 + 3×1 = 4; y[4] = 3×0.5 = 1.5. So x ∗ h = [0, 1, 2.5, 4, 1.5].

A quick check: the outputs sum to 9, which equals (1 + 2 + 3) × (0 + 1 + 0.5) = 6 × 1.5.

Circular example: x = [1, 2, 3], h = [1, 0, 1], N = 3
nTermsy[n]
01×1 + 2×1 + 3×03
11×0 + 2×1 + 3×15
21×1 + 2×0 + 3×14

Where convolution shows up

Convolution describes how a linear, time-invariant system responds to an input: h is the impulse response and y is the output. It also multiplies polynomials, since the coefficients of the product are the convolution of the coefficient lists, and it smooths data with moving averages.

Values are handled in floating point and shown to 10 significant digits. Each sequence can have up to 200 values.

How to use the Convolution Calculator

Enter two sequences and read each output sample with its sum of products.

  1. Choose linear or circular

    Pick linear for the full result, or circular and set the period N.

  2. Enter the sequences

    Type x[n] and h[n] as numbers separated by commas or spaces.

  3. Set start indices

    For linear convolution, enter the index of each first sample if it is not 0.

  4. Read the steps

    Each output shows the products that were added to make it.

References

Frequently asked questions

How long is the result of a convolution?

For linear convolution, Nx + Nh − 1 samples. Two sequences of 3 and 4 samples give 6 outputs. Circular convolution always returns exactly N samples.

What is the difference between linear and circular convolution?

Linear convolution lets the output grow past both inputs. Circular convolution wraps indices around a period N, so samples that would fall past the end fold back to the start. Zero-pad to N ≥ Nx + Nh − 1 to make them equal.

Can I use convolution to multiply polynomials?

Yes. Enter each polynomial's coefficients from the constant term up. For (1 + x)(1 + x), convolving [1, 1] with [1, 1] gives [1, 2, 1], which is 1 + 2x + x².

Last updated . Results are estimates for informational purposes only.