How to use findpeaks to only find specific peaks and time where they occurred?
22 次查看(过去 30 天)
显示 更早的评论
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 个评论
Image Analyst
2019-12-22
编辑:Image Analyst
2019-12-22
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.
回答(1 个)
Image Analyst
2019-12-22
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!