Clear Filters
Clear Filters

How to calculate area under curve.

1 view (last 30 days)
Sun Kyoo Choi
Sun Kyoo Choi on 13 Apr 2020
Commented: Ameer Hamza on 13 Apr 2020
So, I am trying to get an area under curve (shaded area) shown above,
Assuing the boundry is "a" and "b", how could I calculate this area under curve?
  2 Comments
James Tursa
James Tursa on 13 Apr 2020
If you have functions defining a and b, simply integrate a - b. How are a and b defined? Functions, or data points, or ...?
Sun Kyoo Choi
Sun Kyoo Choi on 13 Apr 2020
Edited: Sun Kyoo Choi on 13 Apr 2020
Everything is in data points.
So, basically, I imported from the excel datasheet and extracted to MATLAB.
Also, I know a and b values.
How would the code look like?

Sign in to comment.

Answers (2)

Ameer Hamza
Ameer Hamza on 13 Apr 2020
Edited: Ameer Hamza on 13 Apr 2020
If the curve is available as datapoints, then you can use trapz(): https://www.mathworks.com/help/matlab/ref/trapz.html
For a specific example, please share the datapoints as a mat file.
  4 Comments

Sign in to comment.


KSSV
KSSV on 13 Apr 2020
Edited: KSSV on 13 Apr 2020
Read about polyarea

Community Treasure Hunt

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

Start Hunting!