How to calculate the area under curve?

I have attached a curve in which x axis is time and y axis is amplitude. How to calculate the area under this curve.Please suggest me.

 Accepted Answer

Torsten
Torsten on 27 May 2021
area_under_curve= trapz(x,y)

3 Comments

I am little confused with area_under_curve= trapz(x,y) because if I wrote area_under_curve= trapz(y), then answer is 32.600 but if I wrote area_under_curve= trapz(x,y) then answer is 1.8051e+03.
So, please suggest me which one is correct.
Torsten
Torsten on 28 May 2021
Edited: Torsten on 28 May 2021
If the spacings between the x-values is 1, you can use trapz(y), else you must use trapz(x,y).
The fact that the two results are different indicates that the spacing is different from 1 in your case.
Thank you so much.

Sign in to comment.

More Answers (0)

Categories

Tags

Asked:

AS
on 27 May 2021

Commented:

AS
on 31 May 2021

Community Treasure Hunt

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

Start Hunting!