第1个回答 2017-07-11
做了一个例子,希望有所帮助。代码clc;clearall;closeall;figure;subplot(1,2,1);[x,y,z]=sphere;%定义球面等分数,缺省值为20mesh(x,y,z);%绘制图形hiddenoff;axisequal;holdon;x=0:0.01:0.5;y=x;r=[(x.^2+y.^2)/x,(x.^2+y.^2)/x];[x,y,z]=cylinder(r,80);%定义圆柱面surf(x,y,z);xlabel('x轴');ylabel('y轴');zlabel('z轴');gridon;boxon;view(-45,45);subplot(1,2,2);[x,y,z]=sphere;%定义球面等分数,缺省值为20mesh(x,y,z);%绘制图形hiddenoff;axisequal;holdon;x=0:0.01:0.5;y=x;r=[(x.^2+y.^2)/x,(x.^2+y.^2)/x];[x,y,z]=cylinder(r,80);%定义圆柱面surf(x,y,z);xlabel('x轴');ylabel('y轴');zlabel('z轴');gridon;boxon;view(-75,75)结果