function y=avgsmth(x,M,N)
% AVGSMTH  Smooth an image with an MxN averaging filter
%	y=avgsmth(x,M,N) 

if nargin<3,
  N=M;
end

w=ones(M,1)/M;
y=filter2(w,x);
w=ones(1,N)/N;
y=filter2(w,y);
