给你个均值的提示吧,仅供参考A=rand(100);A=[zeros(100,1) A zeros(100,1)];A=[zeros(1,102); A ;zeros(1,102)];for i=2:101 for j=2:101 B(i-1,j-1)=sum(sum(A(i-1:i+1,j-1:j+1)))/9; endend