本文转自
http://www.cnblogs.com/tiandsp/archive/2012/02/26/2368533.html
clear;
m=31;
n=31;
img=zeros(m+1,n+1);
img=double(img);
pi=3.1415926;
sigma=10;
for i=-(m/2):m/2
for j=-(n/2):n/2
img(i+m/2+1,j+n/2+1)=(1/(2*pi*sigma*sigma))*exp(-(i*i+j*j)/(2*sigma*sigma));
end
end
img=mat2gray(img);
imshow(img);