How to find area under curve
조회 수: 102 (최근 30일)
이전 댓글 표시
I imported a set of data into matlab and have plotted the curve. However, I do not know how to use trapz to find the area under the curve.
댓글 수: 0
채택된 답변
the cyclist
2021년 10월 8일
I did not open your text file, but assuming you got that plot using
plot(x,y)
then it should be as easy as
trapz(x,y)
댓글 수: 3
the cyclist
2021년 10월 8일
% Load data
data = readtable('discharge 30mA.txt');
% Drop the last point, which is NaN
x = data{1:end-1,1};
y = data{1:end-1,2};
% Plot the data
figure
plot(x,y)
% Calculate the area
area = trapz(x,y)
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
