Convolution Calculator

Enter signal values one per line, or separated by commas, semicolons, or spaces. See Example

Convolution Calculator

What is Convolution?

Convolution is a mathematical operation that combines two signals to produce a third signal. It's widely used in various fields such as signal processing, image processing, and probability theory. There are two main types of convolution: linear convolution and circular convolution.

Linear Convolution

Linear convolution is the standard form of convolution. It's like sliding one signal over another, multiplying the overlapping parts, and summing the results. This operation extends the length of the output signal beyond that of the input signals.

Linear Convolution Formula

\[ (f * g)[n] = \sum_{m=-\infty}^{\infty} f[m] \cdot g[n-m] \]

Where:

  • \(f\) and \(g\) are the input signals
  • \(*\) denotes the convolution operation
  • \(n\) is the index of the output signal
  • \(m\) is the sliding index

Circular Convolution

Circular convolution, also known as cyclic convolution, is a special case where the signals are treated as if they were periodic. This means the end of the signal wraps around to the beginning. It's often used in digital signal processing and Fourier analysis.

Circular Convolution Formula

\[ (f \circledast g)[n] = \sum_{m=0}^{N-1} f[m] \cdot g[(n-m) \bmod N] \]

Where:

  • \(f\) and \(g\) are the input signals
  • \(\circledast\) denotes circular convolution
  • \(N\) is the period (usually the length of the signals)
  • \(\bmod\) is the modulo operation

Calculation Steps (Linear Convolution)

  1. Take your two input signals
  2. Flip (reverse) one of the signals
  3. Slide the flipped signal over the other one
  4. At each step, multiply the overlapping values
  5. Sum these multiplications
  6. This sum is one point in your output signal
  7. Repeat for all positions to get the full convolved signal

Example and Visual Representation

Let's use a simple example for linear convolution:

Signal 1: [1, 2, 3]

Signal 2: [0, 1, 0.5]

1 2 3 0.5 1 0 0.5 2 3.5 3 1.5

In this diagram, the blue signal is our first input, the red signal is our second input (flipped), and the purple signal at the bottom is the result of their linear convolution. We slide the red signal over the blue one, multiply the overlapping parts, and sum them to get each point in the purple signal.

Circular Convolution

Circular convolution is similar to linear convolution, but it treats the signals as if they were periodic. This is particularly useful in signal processing applications involving Fourier transforms.

Calculation Steps (Circular Convolution)

  1. Take your two input signals of equal length
  2. Pad the shorter signal with zeros if lengths differ
  3. Flip (reverse) one of the signals
  4. Rotate the flipped signal and multiply with the other signal
  5. Sum the products for each rotation
  6. Repeat for all rotations to get the full circularly convolved signal

Example and Visual Representation of Circular Convolution

Let's use a simple example for circular convolution:

Signal 1: [1, 2, 3]

Signal 2: [1, 1, 0]

Signal 1 1 2 3 Signal 2 (flipped) 0 1 1

In this circular representation, Signal 1 is shown in blue and the flipped Signal 2 in red. For circular convolution, we rotate the red signal and multiply corresponding values with the blue signal, then sum. This process is repeated for each rotation.

The result of circular convolution would be: [4, 5, 3]

  • 4 = 1*1 + 2*1 + 3*0
  • 5 = 1*0 + 2*1 + 3*1
  • 3 = 1*1 + 2*0 + 3*1

This circular method ensures that the output signal has the same length as the input signals, which is particularly useful in certain signal processing applications.