Question: Write a code in matlab. A dart, thrown at random, hits a square target. Assuming that any two parts of the target of equal area
Write a code in matlab. A dart, thrown at random, hits a square target. Assuming that any two parts of the target of equal area are equally likely to be hit, find the probability that the point hit is nearer to the center than to any edge. Note that the answer does not depend on the size of the square. Complete the following function that takes the number of samples as input and outputs the probability.
function p=d a r t ( n ) % n i s t h e number o f h i t s and p i s t h e p r o b a b i l i t y t h a t t h e % p o i n t h i t i s ne a re r t o t h e c e n t e r than t o any edge .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
