Question: (Matlab) Convert the code below (Area Calculation) into the functions as described below: (2) Area calculation with slices of rectangles function [AreaSim]=rect_area(Curve, Range, NOR) wherein
(Matlab) Convert the code below (Area Calculation) into the functions as described below:
(2) Area calculation with slices of rectangles
function [AreaSim]=rect_area(Curve, Range, NOR)
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, NOR is the number of rectangles 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
Get step-by-step solutions from verified subject matter experts
