Sort of peak analysis
Show older comments
I'd like to analyze this graph (is a vector) to have an answer like this:

for 1 to number of peaks:
PEAK_1=[start of peak_1, finish of peak_1, maximum, area under peak_1]
PEAK_2=[start of peak_2, finish of peak_2, maximum, area under peak_2]
...
...
PEAK_N=[start of peak_N, finish of peak_N, maximum, area under peak_N]
I am planning to do a "for" loop checking each value and its predecesor to determine when does a peak start and finish and a while to take the actions. My question is, is there any easier way to determine when does each peak star and finish?
Also, if anybody has any imaginative way better than mine it will be welcome.
5 Comments
dpb
on 6 Sep 2019
findpeaks returns width on either side of peak, do you need actual start/finish or is the width adequate for purpose?
Diego R
on 7 Sep 2019
Then look for the first zero either side of each peak returned by findpeaks -- or, use the width from findpeaks with one side with the threshold level at zero.
Alternatively, if the signal is noise-free as appears (but, of course, the scaling is such small deviations may not be apparent in the graph) find where diff() is +/- and the first/second element is zero. Converting the signal to sign() could help.
Image Analyst
on 8 Sep 2019
Diego, are you not seeing all the answers below, in the official "Answers" section rather than up here in the Comments section? If you need more help, then attach your signal in a .mat file with the paper clip icon.
darova
on 8 Sep 2019
i agree
Accepted Answer
More Answers (2)
Image Analyst
on 7 Sep 2019
If you have the Image Processing Toolbox, you could use regionprops
props = regionprops(signal < 0, 'PixelIdxList');
It will give you, for each peak, the starting and stopping point. You could also ask for MeanIntensity and Area and multiply those together to get the area under the curve. Let me know if you can't figure it out, and attach your signal in a .mat file.
Fabio Freschi
on 7 Sep 2019
1 vote
If the signal is not too noisy you can work with ‘diff’ and look for the change of sign
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!