clear;
N1=400; N2=400;
N3=40;
x1=linspace(-1,1,N1);
y1=linspace(1,-1,N1);
[ ] = meshgrid(x1,y1);
R1 = sqrt(X1.^2 + Y1.^2);
%-----------------
x2=linspace(-1,1,N2);
y2=linspace(1,-1,N2);
[ ] = meshgrid(x2,y2);
R2= sqrt(X2.^2 + Y2.^2);
%----------------
x3=linspace(-1,1,N3);
y3=linspace(1,-1,N3);
[ ] = meshgrid(x3,y3);
R3= sqrt(X3.^2 + Y3.^2);
Z1 = exp(-R1.^2/0.2); Z1(R1>1)=nan;
Z2 = exp(-R2.^2/0.01); Z2(R2>0.3)=nan;
Z3 = exp(-R3.^2/0.01); Z3(R3>0.3)=nan;
%===================
C1(:,:,1) = 0.6*ones(N1); % red
C1(:,:,2) = 0.6*ones(N1); % green
C1(:,:,3) = 0.6*ones(N1); % blue
%===================
C2(:,:,1) = 0.5*ones(N2); % red
C2(:,:,2) = 0*ones(N2); % green
C2(:,:,3) = 0.42*ones(N2); % blue
%===================
C3(:,:,1) = 1*ones(N3); % red
C3(:,:,2) = 1*ones(N3); % green
C3(:,:,3) = 1*ones(N3); % blue
% mesh(X1,Y1,Z1,C1,'FaceAlpha','0.4','linewidth',0.5,'EdgeAlpha',0.5)
surf(X1,Y1,Z1,'FaceAlpha','0.4','FaceColor','[0.8 0.8 0.8]','EdgeColor','none')
hold on
surf(X2,Y2,Z2,'FaceAlpha','0.8','FaceColor','[0.5 0 0.42]','EdgeColor','none')
mesh(X3,Y3,Z3,C3,'Facecolor','none','linewidth',0.5)
%% 光照
lighting phong
camlight('headlight')
camlight('right')
% material dull
view(3);
axis off
daspect([1,1,0.5])
f.Color = 'white';
% print(gcf,'-dbitmap','-r2000','figure2.bmp
以上,希望对大家有所帮助!
免责声明:本公众号旨在传递更多科研相关内容及分享,所有文章图片来源均注明出处,如涉及版权问题,请作者第一时间后台联系,我们将协调进行处理,对于投稿内容文责自负。