I need help figuring the code out.
1 view (last 30 days)
Show older comments
Find the area enclosed by y = e^x , y = x, x = 0, and x = 2 please help me code this problem please
2 Comments
Cris LaPierre
on 2 Mar 2021
You may be mistaken on what MATLAB Answers is. This is not a MATLAB coding service. We are here to answer your MATLAB questions.
Answers (1)
Walter Roberson
on 3 Mar 2021
You can use a Monte Carlo method:
format long g
R = randi([2 3])
xy = rand(10000,2) * exp(R);
x = xy(:,1); y = xy(:,2);
mask = y <= exp(x) & y >= x & x <= 2;
portion = mean(mask)
area = portion * exp(R).^2
0 Comments
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!