1、%先分出二维的格子[x,y]=meshgrid(-8:0.01:8);%写出耖邸苍焚半径表达式,eps防止0/0r=sqrt(x.^2+y.^2)+eps;
2、%删除圆外部分for k=1:1601 for l=1:1601 i酆璁冻嘌f r(k,l)>8 r(k,l)=nan; end endend
3、%墨西哥草帽的关键函数z=sin(r)./r;
4、%earth效果,可加可不加load earthcolormap(map);
5、%画草帽mesh(z);axis off;shading interp