Can I Use MinPeakProminence and MinPeakDistance at the same time?
조회 수: 9 (최근 30일)
이전 댓글 표시
Hello,
I will need to find each peak (dip) from a data point. However, some of the peaks are very close to each other and in that case, I need just one peak instead of all. So I used 'MinPeakDistance' so that I can maintain a gap between two peaks. At the same time, I also need to use the 'MinPeakDProminence'. Can I use both at the same time? I used both but it looks it did not help. Still I can see two dips (first dip locations) very close to each other. In the attached figure, I tried to detect dip instead of peak.
[vl, vlocs]=findpeaks(-y2,'MinPeakProminence',2,'MinPeakDistance',0.5);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1138110/image.jpeg)
댓글 수: 1
Mathieu NOE
2022년 9월 29일
hello
can you share your data ?
maybe you simply need a bit of smoothing so that you get only one global dip
if that is a valid option, try with smoothdata
답변 (1개)
Eric Delgado
2022년 9월 29일
Yeah, sure. It's possible. Take a look at documentation of findpeaks.
- If you specify a location vector, x, then 'MinPeakWidth' must be expressed in terms of x.
- If you specify a sample rate, Fs, then 'MinPeakWidth' must be expressed in units of time.
- If you specify neither x nor Fs, then 'MinPeakWidth' must be expressed in units of samples.
% Instead of:
[vl, vlocs]=findpeaks(-y2, 'MinPeakProminence', 2, 'MinPeakDistance', 0.5);
% Do this:
[vl, vlocs]=findpeaks(-y2, x, 'MinPeakProminence', 2, 'MinPeakDistance', 0.5);
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!