Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB One way to estimate the outcome of for a problem is to use a Monte Carlo simulation which uses a large number of random

MATLAB

One way to estimate the outcome of for a problem is to use a Monte Carlo simulation which uses a large number of random numbers and then compares the results of these numbers. For estimating pi, we can visualize a circle of radius 1 inside a square with a side of 2, both centered on zero.

image text in transcribed

The area of the square is 4 and the area of the circle is pi. The ratio of the area of the circle to the area of the square is pi/4. Consequently, if a large number of points (N) with x and y values varying between 1 and -1 is generated, the number of points falling inside the circle would be

Points in circle = N*pi/4

The number of points falling inside the circle can be determined by the condition x2 + y2

Use the built-in functions of length and find to determine the number of points falling in the circle for the row vectors of 10000 elements and the row vectors containing 1000000 elements. Then use these values to calculate the estimate of pi. (Do not use any built-in functions other than find, length and rand for this problem.)

The script file should generate row vectors of random numbers. You should have 2 scenarios: 10000 x-values and 10000 y-values the scenario of 1000000 x-values and 1000000-y values. Add comments to the end of this problem stating why you did not get the same value for pi for both scenarios.

-1 1 -1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

9. What is a final assembly schedule (FAS)? What is its purpose?

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago