Linear Convolution Calculator

Linear Convolution Calculator

Growing AI Skill PRO

Enter Calculation

Formula

y[n]=∑kx[k]·h[n−k]y[n] = \sum_{k} {x[k]} \cdot {h[n-k]}
Usage stats

Advertisement

Results

Linear Convolution
1, 3, 5, 3
First Sequence 1,2,3
Second Sequence 1,1
Maximum Value 5
Minimum Value 1

Report an error on this page

What This Calculator Does

The Linear Convolution Calculator takes two discrete sequences and combines them using the discrete linear convolution operation. Convolution is a fundamental tool in digital signal processing (DSP), used to compute the output of a linear time-invariant (LTI) system when you know its input signal and its impulse response. Enter your two number sequences and the tool instantly returns the full convolved sequence, along with its maximum and minimum values.

How to Use It

There are just two input fields:

  • First Sequence – your input signal x, entered as comma-separated numbers, e.g. 1, 2, 3.
  • Second Sequence – your second signal h (often an impulse response), e.g. 0, 1, 0.5.

Decimals and negative numbers are both supported. Each value is trimmed and parsed as a number, so spacing does not matter.

The Formula

The discrete linear convolution is defined as:

$$y[n] = \sum_{k} x[k] \cdot h[n-k]$$

In practice the calculator implements this with a direct double loop: every element of the first sequence is multiplied by every element of the second, and each product \(x[i]\cdot h[j]\) is added into output position \(i + j\). The resulting sequence has a length of len(x) + len(h) − 1.

Advertisement
Flip-and-slide visualization of linear convolution of two discrete sequences
Linear convolution flips one sequence and slides it across the other, summing the overlapping products.

Worked Example

Let x = [1, 2, 3] and h = [1, 1]. The output length is \(3 + 2 - 1 = 4\).

  • \(y[0] = 1\cdot 1 = 1\)
  • \(y[1] = 1\cdot 1 + 2\cdot 1 = 3\)
  • \(y[2] = 2\cdot 1 + 3\cdot 1 = 5\)
  • \(y[3] = 3\cdot 1 = 3\)

So the convolution is [1, 3, 5, 3], with a maximum value of 5 and a minimum value of 1.

Convolution computed as a multiplication grid summed along diagonals
Each output value is the sum of element products along a diagonal of the multiplication grid.

Key Terms in Convolution

Term Meaning
Discrete sequence \(x[n]\) An ordered list of numbers indexed by an integer \(n\), typically samples of a signal. The entries you type as comma-separated values are \(x[0],x[1],x[2],\dots\)
Impulse response \(h[n]\) The output a system produces when its input is a single unit impulse. For an LTI system it fully characterises the system: the response to any input is that input convolved with \(h[n]\).
LTI system Linear time-invariant: scaling and adding inputs scales and adds the outputs (linearity), and delaying the input only delays the output (time invariance). Convolution describes exactly the LTI class.
Unit impulse \(\delta[n]\) The sequence equal to 1 at \(n=0\) and 0 everywhere else. It is the identity element of convolution: \(x[n]*\delta[n]=x[n]\).
Kernel / filter taps Common names for the finite sequence \(h\) when it is used as a filter. Each individual coefficient \(h[k]\) is a "tap"; a length-5 kernel is a 5-tap filter.
Convolution sum \(y[n]=\sum_{k} x[k]\,h[n-k]\) — for each output index \(n\), multiply every input sample by the kernel value whose index makes \(k+(n-k)=n\), then add the products.
Support / length The set of indices where a sequence is non-zero. For finite sequences of length \(N\) and \(M\), the convolution has support of length \(N+M-1\).
Index \(n\) and shift \(n-k\) \(n\) is the output position; \(k\) runs over the input samples. Writing \(h[n-k]\) means the kernel is time-reversed (flipped) and slid to position \(n\) — the "flip and slide" picture of convolution.
Linear vs circular convolution Linear convolution (this calculator) grows to length \(N+M-1\). Circular convolution treats the sequences as periodic of length \(L=\max(N,M)\) and wraps the overflow back to the start, giving a length-\(L\) result; it is what an element-wise product of two DFTs corresponds to.
Cross-correlation \(r[n]=\sum_k x[k]\,h[k+n]\) — the same slide-and-sum operation but without the flip. Correlation of \(x\) with \(h\) equals convolution of \(x\) with the time-reversed \(h\); the two coincide when \(h\) is symmetric.
Commutativity \(x*h=h*x\): swapping the two entries gives the same output sequence.
Associativity \((x*h_1)*h_2=x*(h_1*h_2)\): cascaded filters can be combined into one equivalent kernel.
Distributivity \(x*(h_1+h_2)=x*h_1+x*h_2\): parallel branches add, which is the basis of decomposing filters.
Zero-padding Appending zeros to a sequence. Zeros do not change a linear convolution's non-zero values, but padding both sequences to length \(\ge N+M-1\) makes a circular (DFT-based) convolution equal the linear one.
Advertisement

Interpreting Your Convolved Sequence

What the output indices mean. The calculator reports \(y[0],y[1],y[2],\dots\) assuming both inputs begin at index 0. If your sequences actually start elsewhere, the first output sample sits at the sum of the two starting indices: if \(x\) starts at \(n_x\) and \(h\) starts at \(n_h\), then \(y\) starts at \(n_x+n_h\). For example, a kernel centred at \(-1\) convolved with a signal starting at 0 gives an output whose first sample belongs at \(n=-1\), so you must shift the printed list left by one before plotting it against time.

Length and spreading. The output length is always

$$\operatorname{len}(y)=\operatorname{len}(x)+\operatorname{len}(h)-1$$

so the signal spreads by \(\operatorname{len}(h)-1\) extra samples. Those extra samples appear as a start-up transient (the first \(\operatorname{len}(h)-1\) outputs, where the kernel only partially overlaps the data) and a tail-off at the end. In real-time filtering these edge samples are often discarded or treated separately, because they are computed from incomplete overlap rather than from the full kernel.

The sum check. A quick way to confirm a result is that the total of the output equals the product of the input totals:

$$\sum_n y[n]=\left(\sum_n x[n]\right)\left(\sum_n h[n]\right)$$

For \(x=[1,2,3]\) and \(h=[1,1]\) the output is [1, 3, 5, 3], whose sum is \(1+3+5+3=12\), matching \(6\times 2=12\). If your totals do not match, an index has been dropped or a sign mishandled.

What the kernel's sum tells you. If \(\sum_n h[n]=1\), the operation preserves the signal's overall level and average — this is the signature of a smoothing or low-pass kernel such as \([0.5,0.5]\) or \([1/3,1/3,1/3]\). If \(\sum_n h[n]=0\), constant parts of the input are annihilated and only changes survive: \(h=[1,-1]\) is a first-difference (high-pass) kernel that outputs zero on any constant stretch and produces spikes at edges. A kernel summing to a value greater than 1 applies net gain; less than 1 (but non-zero) applies net attenuation.

Peak amplitude. The reported maximum and minimum give the largest positive and negative excursions of the filtered signal — useful for spotting overflow or clipping in fixed-point implementations. Every output sample obeys

$$|y[n]|\le\left(\sum_k |x[k]|\right)\max_k |h[k]|$$

which is a safe worst-case bound. A tighter and equally standard bound is \(\max_n|y[n]|\le \max_n |x[n]|\cdot\sum_k|h[k]|\); the quantity \(\sum_k|h[k]|\) is the filter's gain against the worst-case bounded input.

Impulse behaviour. Convolving with \(\delta[n]=[1]\) returns the input unchanged, and convolving with a shifted impulse — \([0,0,1]\), i.e. \(\delta[n-2]\) — returns an exact copy delayed by 2 samples. This makes impulses a convenient sanity test: if a kernel is meant to be neutral, feeding it a single 1 should reproduce the kernel itself, since \(\delta[n]*h[n]=h[n]\).

These properties are general mathematical facts about discrete linear convolution and are not tied to any national standard or software package. If you are comparing results with a DFT-based routine, remember that it computes circular convolution unless both sequences are zero-padded to at least \(\operatorname{len}(x)+\operatorname{len}(h)-1\).

Frequently Asked Questions

How long is the result? Always the sum of the two input lengths minus one. Convolving a 4-element and 3-element sequence gives 6 values.

Does the order of the sequences matter? No. Convolution is commutative, so swapping the first and second sequence produces the same output sequence.

Is this the same as cross-correlation? No. Convolution flips one sequence (the \(h[n - k]\) term) before sliding, whereas correlation does not. They give different results unless one sequence is symmetric.

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators