function mat = g2d( gsize, sigma, center)

if nargin<3 
    center = 0.5*gsize; 
end
[R,C]       =   ndgrid( 1:gsize(1), 1:gsize(2));
mat         =   g1( C, R, sigma, round( center));


function val = g1(x, y, sigma, center)

yc          =   center(1);
xc          =   center(2);
exponenty   =   (y-yc).^2 ./ (2*sigma(1)^2);
exponentx   =   (x-xc).^2 ./ (2*sigma(end)^2);
val         =   exp( -(exponentx+exponenty));
