Area under curve using trapz

71 Ansichten (letzte 30 Tage)
Kyle Henderson
Kyle Henderson am 30 Jul. 2019
Hello,
I am trying to calculate the area under the curve and partial area under the curve for a scalogram created from a wavelet. The scalograms x axis is logarithmic and the y axis is linear. The values I get when I attempt to run it do not make sense.
  2 Kommentare
Andy
Andy am 30 Jul. 2019
Your question does not give enough information; What is the data you are using? What code are you using? What answers are you getting?
Adam Danz
Adam Danz am 30 Jul. 2019
WME please.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Priyanshu Mishra
Priyanshu Mishra am 2 Aug. 2019
I am assuming that you have changed your X axis values in logarithmic scale and stored it in the new variable.
Now, use the function trapz to calculate the complete area under the curve where, variable ‘X’ should be logarithmic values.
For partial area under the curve, you can use the following sample code:
% let us assume that you want to calculate area in the range [5:15]
Index_begin= 5 ;
Index_end= 15;
X_new= x(Index_begin:Index_end); % x is contains all the values in X axis
Y_new= y(Index_begin:Index_end); % y contains all the values in Y axis
Partial_area = trapz(X_new,Y_new);

Community Treasure Hunt

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

Start Hunting!

Translated by