How to use findpeaks to only find specific peaks and time where they occurred?

조회 수: 17 (최근 30일)
Zuha Yousuf
Zuha Yousuf 2019년 12월 22일
편집: Image Analyst 2019년 12월 22일
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
  댓글 수: 3
Zuha Yousuf
Zuha Yousuf 2019년 12월 22일
Thank you so much for your answer! I am a little confused about where you explained detecting the peaks I dont want. The code I wrote is as follows:
[peaks_noise,locs_noise,w_noise,proms_noise]=findpeaks(-signal,'MinPeakHeight',2.42e-5,'MinPeakDistance',16.7);
This outputs all the info about the peaks that I don't want.
You next said that I need to run findpeaks with MinPeakHeight to find the peak that I do want. Is there a way to eliminate the unwanted peaks I previously found from this signal, and then run findpeaks on a new cleaned signal to just locate this peak that I want? Since the findpeaks only outputs the locations and magnitudes of the peaks.
Image Analyst
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
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);

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by