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

8 Ansichten (letzte 30 Tage)
% 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!

Antworten (1)

Star Strider
Star Strider am 31 Mär. 2024
Bearbeitet: Star Strider am 31 Mär. 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.
.

Kategorien

Mehr zu AI for Signals finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by