Tuesday, May 05, 2009

DSP: How to understand convolution.

OP here.

Definition from wikipedia:



The convolution of ƒ and g is written ƒ∗g. It is defined as the integral of the product of the two functions after one is reversed and shifted.



Let the unit response of a filter be denoted by u, and let x denote the input, y denote the output. Think of the input as the sum of many different delayed and scaled unit inputs:


t = [1, 2, 3, 4, ... n]

x = [x(1), 0, 0, 0, 0 ... 0]
+ [0, x(2), 0, 0, 0 ... 0]
+ [0, 0, x(3), 0, 0 ... 0]
+ ...
+ [0 ... 0, 0, 0, 0, x(n)]



then the output could be seen as the sum of responses to these unit inputs:


y = [u(1)*x(1), u(2)*x(1), u(3)*x(1) ... u(n)*x(1)]
+ [0, u(1)*x(2), u(2)*x(2), u(3)*x(2) ... u(n-1)*x(2)]
+ [0, 0, u(1)*x(3), u(2)*x(3), u(3)*x(3) ... u(n-2)*x(3)]
+ ...
+ [0, 0, ... 0, 0, u(1)*x(n)]


so at particular time n, the output takes the form of:

y(n) = u(n)*x(1) + u(n-1)*x(2) + u(n-2)*x(3) + ... + u(1)*x(n)


which explains why "flipping" is needed in convolution.

No comments: