clc;clear
R=1000;
h=[];
r=60.5;
fork=20:0.1:60
R=kr;
test_r1=rsqrt(3);
%奇数列排列
p=[];
forj=1:2:2k
fori=1:2:2k
p=[p;jr3/2,itest_r1/2];
p=[p;jr3/2,-itest_r1/2];
p=[p;-jr3/2,itest_r1/2];
p=[p;-jr3/2,-itest_r1/2];
end
end
%偶数列排列
fori=0:2:2k
forj=0:k
p=[p;ir3/2,jtest_r1];
p=[p;ir3/2,-jtest_r1];
p=[p;-ir3/2,jtest_r1];
p=[p;-ir3/2,-j*test_r1];
end
end
count=0;
t=[];
p=unique(p,‘row’);
n=length§;
fori=1:n
ifp(i,1)2+p(i,2)2<=(R+r)^2
count=count+1;
t=[t;p(i,1),p(i,2)];
end
end
h=[h;k,count];
end
holdon
plot(h(:,1),h(:,2))
x=h(:,1);
y=h(:,2);
11-21
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-18
1798
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)