Effacer les filtres
Effacer les filtres

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

6 vues (au cours des 30 derniers jours)
Hanna Armstrong
Hanna Armstrong le 31 Mar 2024
Modifié(e) : Star Strider le 31 Mar 2024
% 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!

Réponses (1)

Star Strider
Star Strider le 31 Mar 2024
Modifié(e) : Star Strider le 31 Mar 2024
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.
.

Catégories

En savoir plus sur Preprocessing Data dans Help Center et File Exchange

Tags

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by