The fastest way to find local minimum

조회 수: 3 (최근 30일)
Hg
Hg 2015년 10월 20일
댓글: Hg 2015년 10월 20일
What is the most efficient/fastest way to find the circled local minimum below, the lowest minima between two highest peaks? The graph was created by plot(x,y).
  댓글 수: 5
Walter Roberson
Walter Roberson 2015년 10월 20일
Never name a variable "min"; that interferes with using the MATLAB min() function. For example,
[peaks, locs] = findpeaks(x, y,'MinPeakProminence',100);
[minval, minidx] = min( x(locs(1):locs(2)) );
%minidx is relative to the subset of values, so move it back to full range
minidx = minidx + locs(1) - 1;
Hg
Hg 2015년 10월 20일
편집: Hg 2015년 10월 20일
Thanks for the advice. I think using 'MinPeakProminence' to get 2 highest peaks is not robust enough. It might get more than 2 peaks like below where the first and second peak have same value.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2015년 10월 20일
Invert your signal
invertedSignal = max(signal(:)) - signal;
Now valleys will be peaks. Then call find peaks.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by