% gauss2         2-D Gaussian
%
%       function A = g2(sz,s)
%
% sz : size of returned matrix, [s1 s2]: variance
 
%       M Jagersand 1993
 
 
function A = gauss2(sz,s)
 
  A = zeros(sz);
  xc = (sz(2)+1)/2;
  yc = (sz(1)+1)/2;
  r = s*2;
  for y = 1:sz(1)
    yd = (y-yc)^2/r(1);
    for x = 1:sz(2)
      cr = (x-xc)^2/r(2) + yd;
      A(y,x) = exp(-cr);
    end
  end
