Question: Copy and Paste the MATLAB code 4. (15 points) Extend the solution of Problem 2 by using Monte Carlo analysis to estimate the following integral
Copy and Paste the MATLAB code

4. (15 points) Extend the solution of Problem 2 by using Monte Carlo analysis to estimate the following integral for y: y = [ (x2 + 4)dx Build a rectangle around the area under the curve, and then determine the number of times the randomly generated coordinates fall within the area. Assume that there is equal probability of any location being chosen, such that all randomly selected locations will occur within the area of the rectangle. Do not use the integral of the function in your code. Simply determine the percentage of time the random coordinates end up below the curve. Using your M-file, display the estimated value of the above integral. Then, compare your answer with the mathematical solution by having your M-file determine the percentage error. 4. (15 points) Extend the solution of Problem 2 by using Monte Carlo analysis to estimate the following integral for y: y = [ (x2 + 4)dx Build a rectangle around the area under the curve, and then determine the number of times the randomly generated coordinates fall within the area. Assume that there is equal probability of any location being chosen, such that all randomly selected locations will occur within the area of the rectangle. Do not use the integral of the function in your code. Simply determine the percentage of time the random coordinates end up below the curve. Using your M-file, display the estimated value of the above integral. Then, compare your answer with the mathematical solution by having your M-file determine the percentage error
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
