Using trapz to calculate the area under part of the whole pulse where y is not zero
4 visualizzazioni (ultimi 30 giorni)
I am trying to calculate the area under the pulse between the two specified minima shown in the picture from the whole pulse. I am wondering is it correct to use trapz here although one of the two specified points doesn't have y=0?
Thanks in advance!
Robert Daly il 4 Mag 2023
Spostato: Mathieu NOE il 4 Mag 2023
I would run traps on the peak data set between the two end points.
Then I would run traps using a line between the two endpoints to represent the baseline then subtract that from the first result.
peak.x = [1:10]
peak.y = [2,3,6,20,25,26,20,5,2,1]
baseline = interp1(peak.x([1,end]),peak.y([1,end]),peak.x) %interpolate a striaght line between the first and last data points in the peak
PeakArea = trapz(peak.x,peak.y) - trapz(peak.x,baseline)