用MATLAB 画出圆环面

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 01:26:04
用MATLAB 画出圆环面

用MATLAB 画出圆环面
用MATLAB 画出圆环面

用MATLAB 画出圆环面
你画呀

r=1;% small radius of the small circle

d=2;% distance of small circle to the center

phi=(0:pi/16:2*pi)';% points of small circle

alpha=(0:pi/32:2*pi)';% points of big circle

X2=[d+r*cos(phi) r*sin(phi)];% small circle

Z=X2(:,2)';Z=Z(ones(1,length(alpha)),:);

X=Z;Y=Z;

for i=1:length(alpha)

X(i,:)=cos(alpha(i))*X2(:,1)';Y(i,:)=sin(alpha(i))*X2(:,1)';

end

surf(X,Y,Z)

axis equal