function R = smooth( A )
%smooth - low-pass filter for time-series data.
%   R(i,j) = average of A(i-1,j), A(i,j) and A(i+1,j), for 1 < i < rows(A)
[rows cols] = size(A);
R = A;  % make a copy
for i=2:rows-1    % if A has < 3 rows, this loop will do nothing.
    for j=1:cols
        R(i,j) = (A(i-1,j)+A(i,j)+A(i+1,j))/3;
    end
end
end

