How do I calculate the area of the graph area below the baseline? (matrix plot)
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello
I am a beginner who just started using Matlab.
I'm looking for a way to calculate the area below the baseline in a plot like the following.
I found several ways, but it is not a continuous function, so I am not sure how to solve it, so I am leaving my question here.
The plot was drawn with the following data.
X=[0 3.343500262 4.294170234 5.636154451 7.48743621 9.469759289 10.41901651 12.15558769 12.89110736 14.77076471 16.68885991 18.26626223 18.97234208 19.58596993 20.22027814 20.94334446 21.63233231 22.00504135 23.22534155 24.21344918 25.48740811 27.35688815 30.78198827
]
Y=[216.446 216.581 216.128 216.245 215.729 214.654 214.457 213.028 212.781 212.765 212.698 212.627 212.575 212.544 212.497 212.45 212.595 212.811 213.995 214.146 214.333 216.285 216.269
]
Baseline = [212.45:0.01:216.581]

Is there a way to calculate it?
0 commentaires
Réponse acceptée
Torsten
le 26 Sep 2023
Déplacé(e) : Torsten
le 26 Sep 2023
Your X-vector has two elements more than your Y-vector. After you have corrected this, you could use
idx = find(Y<=214.5);
value = trapz(X(idx),214.5-Y(idx))
4 commentaires
Torsten
le 26 Sep 2023
Modifié(e) : Torsten
le 26 Sep 2023
What does the area under the baseline has to do with the plot command ?
To use an arbitrary baseline, replace the value 214.5 in the two lines of code by the y-value of the baseline in question. Or is the baseline not necessarily parallel to the X-axis ?
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Shifting and Sorting Matrices 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!