How can I calculate a mean value of peak amplitude and area under the curve?
Show older comments
Hello,
I hope someone can help me with my problem. As a healthcare professional, I lack the basic understanding of Data programming and mathematics.
I have a recording of, how the absorption varies, from an infrared photoplethysmography signal obtained in vivo. The data is imported in Matlab as column vectors. I have managed to apply a low pass and a bandpass filter to the raw signal, separating the different components I have to analyse further. From the band pass filtered signal (picture below), I need to – for a number of given time points (illustrated with a green arrow):
- Determine the peak amplitude (local minima to the peak).
- Determine the area under the curve (AUC) – from minima to the peak.
- The amplitude and AUC should be estimated with some mean value, e.g. +/- 5 seconds from the given time point or +/- 5 peaks. I don’t know which of them is the best method?
Does anyone have any suggestions for possible solutions?
I appreciate any help you can provide.

Y-axis: light absorption in arbitrary units, X-axis: time, based on sampling rate (100 Hz) – every second = 100 units
2 Comments
Dyuman Joshi
on 15 Feb 2023
Do you have to find the amplitude and AUC for every peak? or just corresponding to the global maximum peak?
Erik Näslund
on 15 Feb 2023
Accepted Answer
More Answers (1)
Aman
on 15 Feb 2023
Hi,
I understand that you have a function, and you want to find out its global maxima. Then you want to find the nearest local minima on the either side of the global maxima and then calculate the area between the two local minima.
For finding the global maxima you can use the “max” function. Upon getting the global maxima you can use the “islocal” function to get all the local minima, upon getting all the local minima you can find the nearest local minima on the either side of the global maxima. Once you get the local minima of the either side you can find the subsection between them and then use the ”trapz” function to get the area between them. You can refer to the following example:
x = 1:100;
A = (1-cos(2*pi*0.01*x)).*sin(2*pi*0.15*x); % objective function
[maxVal,indx] = max(A); % global maxima
TF = islocalmin(A); % all local minima
for i=indx:-1:1
if(TF(i))
localMinLeft = i;
localMinLeftVal = A(i); % local minima to the left of the global maxima
break;
end
end
for i=indx:100
if(TF(i))
localMinRight = i;
localMinRightVal = A(i); % local minima to the right of the global maxima
break;
end
end
subSection = A(localMinLeft:localMinRight); % subsection between the local minimas
plot(x,A);
hold on;
plot(localMinRight,localMinRightVal,'r*');
plot(localMinLeft,localMinLeftVal,'r*');
plot(x(indx),A(indx),'bo');
plot(localMinLeft:localMinRight,subSection);
hold off;
disp('Area under the curve is ' + trapz(subSection)); % area under the subsection selected
Hope this helps!
1 Comment
Erik Näslund
on 15 Feb 2023
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



