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....
The ratio of the area of the circular dartboard to the area of the square frame is
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
from where ? can be approximated as
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:
(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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started