How do I perform convolution of a matrix with a vector?

TheShinyMaker

New member
Joined
Dec 31, 2020
Messages
1
Good day to you all. I was wondering how to convolve a matrix with a vector (filter) along the row and column axis. Although I can do this convolution on Matlab, I can't seem to find how I ended up with the result it provided.

For example if A = [1, 2; 3, 4]; and K = [-1, 0, 1]; how do I convolve K along the row and column axis and what result do I get from this convolution?

Any insight into this matter would be greatly appreciated.
 
Well you can only convolve a vector with a vector. So to convolve a matrix with a vector you are going to have to break that matrix up into vectors somehow, the obvious choices being using the row vectors, or using the column vectors.

So do your convolution with either set of vectors, you'll end up with a vector, that has basically run the signal that was present in each of those vectors through the filter whose coefficients are in the vector you used for convolution.

So looking at your example
[MATH] A = \begin{pmatrix}1&2\\3&4\end{pmatrix}\\ K= \begin{pmatrix}-1 &0 &1\end{pmatrix}\\ \text{I don't recall seeing any notation specific for this operation but lets distinguish between a convolution of the rows vs. the columns}\\ A *_R K = \begin{pmatrix}(1,2)*(-1,0,1)\\(3,4)*(-1,0,1)\end{pmatrix}= \begin{pmatrix}1&2&-1&-2\\3&4&-3&-4\end{pmatrix}\\ A*_C K = \begin{pmatrix}(1,3)*(-1,0,1)\\(2,4)*(-1,0,1)\end{pmatrix} = \begin{pmatrix}1&3&-1&-3\\2&4&-2&-4\end{pmatrix} [/MATH]
 
I would think that the fact that your matrix is 2 by 2 while you vector has dimension 3 will cause major problems!
 
Top