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!