Question: Matlab help please! Having trouble with this question.... The ratio of the area of the circular dartboard to the area of the square frame is

Matlab help please! Having trouble with this question....

Matlab help please! Having trouble with this question.... The ratio of the

The ratio of the area of the circular dartboard to the area of the square frame is

area of the circular dartboard to the area of the square frame

This ratio is equal to the probability of hitting the circular dartboard when directing a dart at a random point within the square frame. If N darts are thrown and land at random points within the square frame, and n of those N darts hit the circular dartboard, then we can expect that

is This ratio is equal to the probability of hitting the circular

from where ? can be approximated as dartboard when directing a dart at a random point within the square

In your script, model the throwing of darts at random points within the square frame by generating two random real numbers x and y per throw, each in the range from -R to R (the actual value of R you chose will not affect your approximation of ?). You can check whether a dart hit the circular dartboard by testing the condition:

frame. If N darts are thrown and land at random points within (dartboard hit)

Your code should keep on simulating the throwing of darts at random points within the square frame, keeping track of the total number of thrown darts (N), and the number of darts that landed on the dartboard (n), until the absolute difference between your approximated value of ? (given by n/N) and the actual value of ? falls below ?, that is, |?-4n/N| You are to write a script to approximate ? using the Monte Carlo method. First, imagine a circular dartboard of radius R concentrically placed within a square frame of side length 2R, as in the picture below 2R 5 20 12 18 14 13 6 10 2R 16 15 19 3 You are to write a script to approximate ? using the Monte Carlo method. First, imagine a circular dartboard of radius R concentrically placed within a square frame of side length 2R, as in the picture below 2R 5 20 12 18 14 13 6 10 2R 16 15 19 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!