Findpeaks with multiple columns
2 ビュー (過去 30 日間)
古いコメントを表示
So I have an array which is sized at 2000 x 100, called bdata. I want to use findpeaks to determine the peaks in every column of this array. I tried the following:
for g = 2:size(bdata,2)
[pk,loc] = findpeaks(bdata(:,g));
P{g} = [pk loc];
end
But it keeps calculating wrong values and even values not in bdata...
2 件のコメント
回答 (1 件)
Star Strider
2022 年 2 月 16 日
I am not certain what the data are, and without the data an appropriate solution is not possible.
However, there are two observations:
1. The findpeaks call in the question will return the indices of the peaks, not the independent variable value corresponding to those peaks. Finding that however is straightforward — simply use the ‘locs’ result to index into it.
2. The easiest way to be certain that findpeaks returns the desired peak is to use one or more of the name-value pair arguments. The one I use most is 'MinPeakProminence' since it invariably works and is relatively independent of the actual peak height. The 'MinPeakDistance' name-value pair can also help isolate the correct peak.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!