How to find area under curve
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
the cyclist
le 8 Oct 2021
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 commentaires
the cyclist
le 8 Oct 2021
% 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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!