Detecting peaks with a specified range of amplitudes?

2 ビュー (過去 30 日間)
HC98
HC98 2023 年 2 月 9 日
コメント済み: Luca Ferro 2023 年 2 月 27 日
Say i have a signal with range betwene [-3, 3] and I want to locate peaks within an amplitude range of say [0, 1], how might I do this? I.e., detect peak amolitudes within a given boundary of allowed amplitude values?

回答 (1 件)

Luca Ferro
Luca Ferro 2023 年 2 月 9 日
編集済み: Luca Ferro 2023 年 2 月 9 日
if you need the range [0 1] just filter it out of the resulting vector afterwards, for example.
[pks,locs] = findpeaks(PeakSig,x); %peakSgn = the signal you want to analyze, x = the linspace you are working on
upperBound= locs > 0;
lowerBound= locs < 1;
peaksInRange= locs.*upperBound.*lowerBound
or more in a more compact way:
[pks,locs] = findpeaks(PeakSig,x); %peakSgn = the signal you want to analyze, x = the linspace you are working on
peaksInRange= (locs > 0 & locs < 1).*locs;
  1 件のコメント
Luca Ferro
Luca Ferro 2023 年 2 月 27 日
did this solved your problem?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by