Files
matlab-learning/lab2/exercise2_7.m
2025-11-17 11:16:02 +08:00

16 lines
256 B
Matlab

subplot(1,2,1);
x=-3:0.1:3;
y=-3:0.1:3;
z=x.*exp(-x.^2-y.^2);
plot3(x,y,z);
subplot(1,2,2);
[x,y]=meshgrid(-3:0.1:3);
z=x.*exp(-x.^2-y.^2);
surf(x,y,z);
shading interp;
colormap("spring");
k=find(x<=0 & y<=0);
z1=z;
z1(k)=NaN;
surf(x,y,z1);
shading interp;