clear all;
r1=1;
h1=1;
i=0:0.05*pi:2*pi;
x1=r1*cos(i);
y1=r1*sin(i);
z1=-h1*cos(i).*sin(i);
figure(1);
plot3(x1,y1,z1,'Color','r','LineWidth',2);%
hold on
r2=1.5;
h2=1;
x2=r2*cos(i);
y2=r2*sin(i);
z2=-h2*cos(i).*sin(i);
plot3(x2,y2,z2,'Color','g','LineWidth',2);%
for i=1:length(x1)
plot3([x1(i),x2(i)],[y1(i),y2(i)],[z1(i),z2(i)],'-');
end
for i=1:2:360 %旋转展示
%view(a,b):a是角度,b是仰视角
view(i,20);
pause(0.06);
end
请发表评论