How to use findpeaks to only find specific peaks and time where they occurred?
22 views (last 30 days)
Show older comments
I'm attaching a plot of voltage versus time for a signal that I averaged over time. I want to use the findpeaks function to exclude the major peak seen at approx 40 ms, as well as the repetitive downward inflections that repeat. I just want the peakfinder function to automatically locate the inflection I've circled in yellow. Is there a way to find the magnitude of this peak and the time where it occurred, using the findpeaks function? Any other tips to automate this would be welcome as well!
![Capture.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/256711/Capture.jpeg)
3 Comments
Image Analyst
on 22 Dec 2019
Edited: Image Analyst
on 22 Dec 2019
And what was wrong about simply finding and erasing the big two peaks that you don't want before finding the smaller ones, like I showed you in my Answer below? What you just suggested was just what I had shown you an hour before you posted.
Answers (1)
Image Analyst
on 22 Dec 2019
Why can't you just erase everything before 50 ms and then find peaks?
index = find(t < 50, 1, 'last');
amplitude(1:index = 0);
[peakValues, locations] = findpeaks(amplitude);
Or if it's not always there at 50 or so, find the min point and go up until it hits the mean (about -2)
[~, index] = min(amplitude);
meanAmp = mean(amplitude)
while amplitude(index) < meanAmp
index = index + 1;
end
amplitude(1:index = 0);
[peakValues, locations] = findpeaks(amplitude);
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!