function C = conmatrix(ker,n)
% C = CONMATRIX(KER,N)
% 
% Calculates the convolution matrix
%
% KER - Convolution kernel given as column vector
% N - the length of the signal to be convolved

ll = length(ker);

C = zeros(ll+n-1,n);

for i = 1:n,
    C(i:(i+ll-1),i) = ker;
end

end