I need to calculate an estimated value of the circle area. Giving some x coordinates and y coordinates. i Have written the following code, but there is something wrong with it. can test my code by the test script:
circleAreaMC([-0.1, 0.7, 0.8, 0.5, -0.4], [0.3, -0.1, 0.9, 0.6, -0.3]) and it should give 3.2. But it gives 0.303 etc.
I really feel like this problem have a much easier solution, can somebody please help me? I am new to matlab. (started 5 days ago :-) )
function A = circleAreaMC(xvals,yvals)
%A function that estimates the area of a circle by Monte Carlo simulation.
InC = zeros(size(xvals));
DTC = zeros(size(xvals));
%A loop that test wether or not the points are inside the circle: