Convolving Two Short Sequences
Discrete linear convolution combines input and kernel values whose indices add to the current output index.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace two two-element inputs
For inputs \((1,2)\) and \((3,4)\), the output is \((3,10,8)\). The middle value combines \(1\cdot4+2\cdot3\). Indexed traversal locates the pairs contributing to each term.
Keep boundary rules explicit
Finite sequences can be extended by zeros for this full-result convention. Circular convolution combines different index pairs. See FFT and linear convolution for that distinction.[1][2]
Sum only the overlapping products at each index
Let first sequence be \([2,1]\) and second \([3,4]\), both starting at zero with zero extension. Discrete convolution at index zero gives six. At one the overlapping products are eight and three. At two only one times four remains. See short sequences and boundary indices.
Output n=0: 2×3 = 6
n=1: 2×4 + 1×3 = 11
n=2: 1×4 = 4
Full result: [6,11,4]
Define output mode before checking length
The full result of nonempty finite sequences of lengths \(m,n\) has length \(m+n-1\) under ordinary indexing conventions. Cropping or cyclic convolution changes which positions are returned. Test an impulse and asymmetric data.