发布网友 发布时间:2022-04-21 18:56
共1个回答
热心网友 时间:2022-07-11 10:48
function cycle6(px,py,r,n)
%px,py和r分别是大圆圆心坐标和半径,n是迭代次数
%例子:
%cycle6(0,0,1,4);axis equal
t=linspace(-pi,pi);
plot(r*cos(t)+px,r*sin(t)+py)
theta=pi/3*(0:5);
newr=r/3;
newpx=px+2*newr*cos(theta);
newpy=py+2*newr*sin(theta);
if n>1
for i=1:6
hold on;cycle6(newpx(i),newpy(i),newr,n-1);
end
end