How to calculate Area under a curve
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello All,
I am trying to calculate shaded area of my x and y data given in the excel sheet. I am using the following code which calculates the entire area, but I want to subtract the un-shaded area from.
x = xlsread('filename','A:A');
y = xlsread('filename','B:B')
Integral = trapz(x,y);
area(x, y);
;

Is there anyone help me with the correct code please ?. Your response will be appreciated too much.
댓글 수: 0
채택된 답변
Star Strider
2019년 12월 19일
Try this to get the integral only between 20 and 40:
lims = (x >= 20) & (x <= 40);
Integral = trapz(x(lims),y(lims));
추가 답변 (1개)
Elnaz Ensafi
2020년 7월 31일
I have plot that I extracted from EEG data. I would like to extract area under the curve from 25 ms to 275 ms. could you Please help me in this case?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 EEG/MEG/ECoG에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!