大家好,又见面了,我是你们的朋友全栈君。
%A区域生成随机数
%画圆
t=0:pi/100:2*pi;
x=10*cos(t)+30.3;
y=10*sin(t)+89.8;
plot(x,y,'r');
%生成随机数
a=zeros(2,8);
i=1;
while i<=8
temp1=rand(1)*20+20.3;
temp2=rand(1)*20+79.8;
if (temp1-30.3)^2+(temp2-89.8)^2<10^2
a(1,i)=temp1;
a(2,i)=temp2;
i=i+1;
end
end
hold on
plot(a(1,:),a(2,:),'b*')
a1=a';
save a1 a1
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/150864.html原文链接:https://javaforall.net