Site icon Doc Sity

San Diego State University Monte Carlo Simulation MATLAB Task

San Diego State University Monte Carlo Simulation MATLAB Task

Description

i need to submit .m files using MATLAB

equation picture is attached

Procedure

As usual, create a script, include a comment at the top explaining the purpose of the script, your name, and the date it was created.

1. Use the men function to ask the user how accurate they would like their estimate. Set the choices to .1, .01, and .001. Write a switch statement to set a variable tol to .1, .01 or .001 based on the user’s choice.

2. Write a separate function to perform the Monte Carlo simulation. Starting with n = 100, generate n random ordered pairs (x,y) between 0 and 1.

While the absolute value of the difference between your estimate and the true value of pi is less than or equal to your tolerance, perform the Monte Carlo simulation and report to the user how many iterations it took to achieve the desired accuracy.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Exit mobile version