So my script produces two centre circles and then generates other circles of a distributed radius and location. How do I go about finding the radius of the circles that intersect the outer circle but not the inner circle?
% code
th = linspace(0,2*pi);r = 3;x = r*cos(th);y = r*sin(th);C = zeros(1:2);xc1 = C(1,1)+x ;yc1 = C(1,2)+y ;hold ont = plot(xc1,yc1) % Plot tunnel of 3m radius
r = 5;x = r*cos(th);y = r*sin(th);C = zeros(1:2);xc2 = C(1,1)+x ;yc2 = C(1,2)+y ;hold ont2 = plot(xc2,yc2); % Plot tunnel of 3m radius with 2m exclusion
% Produce random circles
for i = (1:10000) % Iterate as many times as needed
R = 0.01 + (1.2 - 0.01)*sum(rand(10000,6),2)/6; % truncated normal distribution from 0.01 to 1.2
r = datasample(R,1); s(i) = (r^2)*pi; s = sum(s);if s < ((50^2)*0.1) % Plot circles until they fill up x% of 50x50 axes
th1 = linspace(0,2*pi); x1 = r*cos(th1); y1 = r*sin(th1); C1 = (-25 + (25+25).*rand(1:2)); % Random centre between -25 and 25
xc = C1(1,1)+x1 ; yc = C1(1,2)+y1 ; hold on % having issues with next part, trying to see if random circle has same coordinates
% as centre circle and then store its radius in matrix
if xc == xc1 and yc == yc1 z(i) = R else end t3 = plot(xc,yc) ; % plots random circle
set(t3(1),'color','black')else endendbox onxlim([-25 25])ylim([-25 25])
Best Answer