摘要:%%theta = linspace(0,2*pi,7);D=2; %边长X=1; %中心横坐标Y=2; %中心纵坐标plot(D*cos(theta)+X,D*sin(theta) + Y,'g-');axis squarei = 0;while i < 3x = 2*D*rand(1,2)-1*D;if (abs(x(1)) + abs(x(2))/sqrt(3) ) <= D && abs(x(2)) <= D*sqrt(3)/2 i = i+1;hold onplot(x(1) + X, x(2) + Y,'r*');e
阅读全文