MATLAB Answers

How to use trapz for area under curve

10 views (last 30 days)
How do I calcuate the area under orange curve from 0-20.
The orange curve is generated by reva2.
  1 Comment
Matt J
Matt J on 2 Apr 2021
What's wrong with the way that is shown in your code?

Sign in to comment.

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 2 Apr 2021
The answer to your exercise is realtively simple:
IND = find(Ua2<=20);
AREA = trapz(Ua2(IND), reva2(IND));
fprintf('The area under the curve within [0, 20] m/s is: %f \n', AREA)
Good luck

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by