用MATLAB绘出以下其中一图

img

你好同学,代码供参考:

x0 = 6; r = 2; 
t1 = linspace(0,2*pi, 40);
t2 = linspace(0,2*pi, 80);
[T1, T2] = meshgrid(t1, t2);
X = (r*cos(T1)+x0).*cos(T2);
Y = r*sin(T1);
Z = (r*cos(T1)+x0).*sin(T2);
figure(2);clf
handle = mesh(X,Y,Z);
shading flat;
axis('equal');
set(handle,'facecolor','r','edgecolor','none')
light('position',[0,0,20],'style','local','color','w');
lighting phong;

如有帮助还望题主给个采纳哟谢谢啦