Find area of two overlapping circles using monte carlo method
<p>Actually i have two intersecting circles as specified in the figure</p>

<p>i want to find the area of each part separately using Monte carlo method in Matlab .</p>

<p>The code doesn't draw the rectangle or the circles correctly so 
i guess what is wrong is my calculation for the x and y and i am not much aware about the geometry equations for solving it so i need help about the equations.</p>

<p><a href="https://i.stack.imgur.com/TV4be.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TV4be.png" alt="enter image description here"></a>
this is my code so far : </p>

<pre><code>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&lt;=25 &amp;&amp; (x(i))^2+(y(i)-12)^2&lt;=100)
count=count+1;        
    figure(2);
    plot(x(i),y(i),'b+')
    hold on

elseif(~(x(i))^2+(y(i))^2&lt;=25 &amp;&amp;(x(i))^2+(y(i)-12)^2&lt;=100)  
    figure(2);
    plot(x(i),y(i),'y+')
    hold on

else 
     figure(2);
    plot(x(i),y(i),'r+')

end

end
</code></pre>