So basically I have to edit this code so that I can find the probability of the points falling within a circle of
radius 0.5 centered at (0.5, 0.5). I then need to run it for 1000 points!!!I'm really new to matlab and can't figure it out.
Code:
N = 100;
figure(1);
clf;
point = rand([2 N]);
plot(point(1,:), point(2,:), 'xb');
xlim([0 1]);
ylim([0 1]);
hold on;
count = 0;
for i=1:N
if (point(1, i) < 0.5) && (point(2,i) < 0.5)
plot(point(1,i), point(2,i), 'xr')
count = count + 1;
end
end
probability = count / N;
title(strcat('Probability is:', num2str(probability)));