源代码及对应的图像: [cc lang=”matlab”] figure; [x,y,z]=sphere(30); z(z<0)=nan; surf(x,y,z); [/cc]

[cc lang=”matlab”] figure; [x,y,z]=sphere(30); z(x<0)=nan; surf(x,y,z); [/cc]

[cc lang=”matlab”] figure; t=linspace(0,2*pi,37); r=linspace(0,1,10); [t,r]=meshgrid(t,r); [x,y]=pol2cart(t,r); surf(x,y,r); hold on; r=r*pi/2; [x,y,z]=sph2cart(t,r,1+0*t); surf(x,y,z+1); axis equal; [/cc]

[cc lang=”matlab”] figure; [fia,theta]=meshgrid([linspace(0,pi,100),pi]); x=sin(theta).*cos(fia); y=sin(theta).*sin(fia); z=cos(theta); surf(x,y,z) shading interp [/cc]

[cc lang=”matlab”] figure; theta=0:0.1:2*pi; phi=theta’; x=cos(phi)*cos(theta); y=cos(phi)*sin(theta); z=sin(phi)*ones(size(theta)); mesh(x,y,z); shading interp [/cc]

[cc lang=”matlab”] figure; ezsurf(‘8*tan(u)*cos(v)’,’8.*tan(u)*sin(v)’,’2.*sec(u)’,[-pi./2,3*pi./2,0,2*pi]) axis equal grid on axis square xlabel(‘x轴’);ylabel(‘y轴’);zlabel(‘z轴’); title(‘双叶双曲面’) [/cc]

[cc lang=”matlab”] figure; [x,y,z]=sphere(30); z(z<0)=nan; surf(x,y,z,'FaceAlpha',0.5); [/cc]