标签:code span img write exp pre a* mat nbsp
1 cl; 2 m=31; 3 n=31; 4 img=zeros(m+1,n+1); 5 img=double(img); 6 pi=3.1415926; 7 sigma=10; 8 for i=-(m/2):m/2 9 for j=-(n/2):n/2 10 img(i+m/2+1,j+n/2+1)=(1/(2*pi*sigma*sigma))*exp(-(i*i+j*j)/(2*sigma*sigma)); 11 end 12 end 13 img=mat2gray(img); 14 imshow(img); 15 imwrite(img,‘pic.bmp‘); 16 17 %一个更好的实现,2012.12.18修改 18 h=5; 19 w=2; 20 [x y]=meshgrid(-w:w,-h:h); 21 sigma=5; 22 img = (1/(2*pi*sigma^2))*exp(-(x.^2+y.^2)/(2*sigma^2));
标签:code span img write exp pre a* mat nbsp
原文地址:https://www.cnblogs.com/ybqjymy/p/13645850.html