In Matlab: how do I quickly create smoothing matrices? 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?
You could do the following-

kernel = [1 2 1];
s = conv2(eye(numMeasurements), kernel, 'same')