Say I have 5 measurements of a signal as a column vector: x. I can smooth the signal by multiplying it with a smoothing matrix:
$\ \mathbf{xs=S*x} $
For instance I might use [1 2 1] as a smoothing kernel in which case I get:
S =
2 1 0 0 0
1 2 1 0 0
0 1 2 1 0
0 0 1 2 1
0 0 0 1 2
So far I have been using the function sparse() to build the matrix diagonal by diagonal, but this quickly becomes tedious.
How can I quickly create a mxm smoothing matrix from a 1xn convolution kernel in Matlab?
filterinstead? Something likefilter([1 2 1],1,x)– Juancho Jul 05 '12 at 16:24