0
两个重叠的圆的面积实际上我有两个相交的圆如图中查找使用蒙特卡洛方法
我想找到分别使用在Matlab蒙特卡罗方法中的每个部分的面积指定。
代码没有正确绘制矩形或圆圈 我想我的x和y的计算出了什么问题,我对解决它的几何方程没有太多的了解,所以我需要关于方程。
n=1000;
%supposing that a rectangle will contain both circles so :
% the mid point of the distance between 2 circles will be (0,6)
% then by adding the radius of the left and right circles the total distance
% will be 27 , 11 from the left and 16 from the right
% width of rectangle = 24
x=27.*rand(n-1)-11;
y=24.*rand(n-1)+2;
count=0;
for i=1:n
if((x(i))^2+(y(i))^2<=25 && (x(i))^2+(y(i)-12)^2<=100)
count=count+1;
figure(2);
plot(x(i),y(i),'b+')
hold on
elseif(~(x(i))^2+(y(i))^2<=25 &&(x(i))^2+(y(i)-12)^2<=100)
figure(2);
plot(x(i),y(i),'y+')
hold on
else
figure(2);
plot(x(i),y(i),'r+')
end
end
究竟什么是你的问题?模糊的*“我需要帮助”*没有解释你想要什么。请描述代码正在做什么,正确和不正确。请描述你想要的。 [帮助]页面提供了很多关于如何写出一个好问题的建议。另见[mcve]。 – AdrianHHH
“我需要帮助”关于几何方程式,我编辑它的任何方式,感谢您的通知 – Suzy