필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
% 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일
편집: Star Strider 2024년 3월 31일
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 CenterFile Exchange에서 Preprocessing Data에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by