How to restrict the Max Peak Height of findpeaks
조회 수: 48 (최근 30일)
이전 댓글 표시
I've managed to set a minimum peak height when plotting some data and finding the peaks but is there a function I can ue to set a max peak height? I can't seem to find one.
As you can see the errors are quite large. My code is as follows:
figure(nF)
findpeaks(ResAcceltrim,'MinPeakDistance',300,'MinPeakHeight',pe);
pks=findpeaks(ResAcceltrim,'MinPeakDistance',300,'MinPeakHeight',pe);
pks=pks(1:20,1);
댓글 수: 0
채택된 답변
Image Analyst
2015년 10월 12일
If you don't want it to find peaks higher than some amount, just set those elements equal to the min. Actually it would be better to find the peaks and then "fall down" the peaks until they turn up again and then interpolate in from both sides, but that's more complicated even though it would be better. Maybe this simple way will do the job for you:
minValue = min(yourSignal);
tallPeakIndexes = yourSignal > someThreshold; % Whatever value you want.
yourSignal(tallPeakIndexes) = minValue; % Or you can use someThreshold instead of minValue.
If that ends up finding spurious peaks at the edges of the flattened peak, then use the more robust second method I suggested.
댓글 수: 0
추가 답변 (1개)
dpb
2015년 10월 12일
You're correct there is no such facility built into findpeaks--one would normally think a large peak would be agoodthing(tm), not something to be avoided.
You'll have to simply test and exclude results from the returned search that exceed the rest by some magnitude (either absolute or as a percentage). Typical tests for outliers might be a ploy to consider in doing so unless you have other ways to decide what is "noise".
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!