Question: (Matlab) Convert the code below (Area Calculation) into the functions as described below: (1) Area calculation with Monte-Carlo simulation function [AreaSim]=monte_area(Curve, Range, NOP) wherein the

(Matlab) Convert the code below (Area Calculation) into the functions as described below:

(1) Area calculation with Monte-Carlo simulation

function [AreaSim]=monte_area(Curve, Range, NOP)

wherein the function output AreaSim is the area calculated, the inputs Curve is the equation of the curve, Range is the starting and ending value, NOP is the number of points (darts) you used to calculate.

%------------------------------------------------------%

N=10000;

Landed=0;

for i=1:N

x=rand()*16;

y=rand()*10;

if(y<2*sqrt(x)+1)

Landed=Landed+1;

end

end

area=10*16*(Landed/N)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!