% g2000    2-D Gaussian
%
%       function A = g2(sz,s)
%
% sz : size of returned matrix, [s1 s2]: variance
 
%       M Jagersand 2000
 
 
function A = gauss2(sz,s)

  A = zeros(sz);
  xc = (sz(2)+1)/2;   % Centerpoints
  yc = (sz(1)+1)/2;
  r = s*2;


  y = 1:sz(1);
  yd = (y-yc).^2/r(1);  % Change .^
  yM = yd'*ones(1,sz(2));

  x = 1:sz(2);
  xd = (x-xc).^2/r(2);
  xM = ones(sz(1),1)*xd;
  A = exp(-xM-yM);


