Help me determine why the Isolocalmax doesn't work after applying MinProminence.

3 ビュー (過去 30 日間)
Hanna Armstrong
Hanna Armstrong 2024 年 3 月 31 日 14:10
編集済み: Star Strider 2024 年 3 月 31 日 17:00
% Identify indirect peak values (aka vallies)
dataDirect = dataOut;
x = 1: (length(dataDirect));
[ TFm, Pm] = islocalmax(dataDirect);
min_localmax = (mode(dataDirect(TFm))+ mean(dataDirect(TFm)))/2;
% max2 = max(dataDirect);
% max_minlimit2 = max2*.9990;
[ TFd, Pd] = islocalmax(dataDirect, 'MinProminence', min_localmax);% max_minlimit2); % aveDiff,
Peak_location1 = (x(TFd))';
Peak_values1 = dataDirect(TFd);
nexttile
hold on
yline(min_localmax,'r-')
plot(x, dataDirect,x(TFd),dataDirect(TFd),'r*')
title('butter ')
For some reason, the islocalmax function is not identifying any peaks when I use 'MinProminence.' If anyone could suggest alternative functions that would be great. The 'islocalmax' works well when I am trying to determine by 'MinProminence' value but after that it no longer works and I can't figure out why since I use this function all of the time.
If anyone has the time to help I would really appreciate it!

回答 (1 件)

Star Strider
Star Strider 2024 年 3 月 31 日 15:18
編集済み: Star Strider 2024 年 3 月 31 日 17:00
You need to check the variable values.
I cannot run this here (the Run feature is currently not working, at least for me, although MATLAB Online works), however running this:
dataOut = randn(500,1);
dataDirect = dataOut;
x = 1: (length(dataDirect));
[ TFm, Pm] = islocalmax(dataDirect);
min_localmax = (mode(dataDirect(TFm))+ mean(dataDirect(TFm)))/2
datamax = max(dataOut) % Added
minPM = min(Pm(Pm ~= 0 ))
produces this result:
min_localmax =
-0.2613
datamax =
3.5784
minPM =
0.0082
So I suspect using an extremely low value for 'MinProminence' (much less than the lowest prominence value returned) is likely the problem.
EDIT — (31 Mar 2024 at 17:00)
Corrected typographical errors.
.

カテゴリ

Help Center および File ExchangePreprocessing Data についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by