function b = smooth(a, n);

%  function b = smooth(a, n);
%
%  Takes array 'a' and convolves it with a rectangular window of length n.
%  NOTE:  n should be odd.  
%
%  Returns a vector the same length as a...


b = conv(a, ones([1 n]));

i1 = 1 + floor((n-1)/2 + 0.0002);

i2 = i1 + length(a) - 1;

b = b(i1:i2)/n;

return;
