用matlab畫出來的三維圖像

這是我用matlab做作業(yè)時(shí)蹦出來的靈感,通過對(duì)原本的函數(shù)調(diào)參,構(gòu)造出來了具有空間感和美感的圖像。





這就是我當(dāng)時(shí)做的題。

下面是源代碼
x=0:0.01:1; % a范圍
y=0:0.01:1; % b范圍
[xx,yy]=meshgrid(x,y); %構(gòu)成格點(diǎn)矩陣
c=(yy-1+sqrt((yy-1).^2+xx))./2; %計(jì)算x
z=-xx.*c+sqrt((xx.*c).^2+yy); %計(jì)算z
cmap = gray(6);
subplot(2,2,1)
surf(xx,yy,z);title('Surfplot'); %子圖1,繪制三維圖形
subplot(2,2,2)
mesh(xx,yy,z);title('Meshplot'); %子圖2,繪制三維曲面
subplot(2,2,3)
surf(xx,yy,z);title('Surplot with shading interp'); %子圖3,繪制三維曲面,表面為光滑
shading interp;
subplot(2,2,4)
contour(xx,yy,z);title('Meshplot'); %子圖4,繪制等高曲線
標(biāo)簽: