필터 지우기
필터 지우기

Finding minima

조회 수: 3 (최근 30일)
Graig
Graig 2011년 2월 15일
I have a data file with few valleys (minima). is there a way to find all the x coordinates corresponding to each minimum y value?

채택된 답변

Matt Tearle
Matt Tearle 2011년 2월 15일
If you want fancy, take Walter's advice and search FEx. If you want quick and dirty:
x = 1:50;
y = sin(5*x);
idx = [false, y(3:end)>y(2:end-1) & y(2:end-1)<y(1:end-2), false];
xmin = x(idx)
plot(x,y,'o-',xmin,y(idx),'rx')
  댓글 수: 7
Matt Tearle
Matt Tearle 2011년 2월 16일
Hah. Actually I just hunt the intartubes looking for places to apply logical indexing! ;)
Paulo Silva
Paulo Silva 2011년 2월 16일
Here's my 1 vote :)

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

추가 답변 (3개)

Walter Roberson
Walter Roberson 2011년 2월 15일
There is are a fair number of postings, and several Matlab File Exchange contributions, for finding peaks, which you could either modify or apply to the negative of your data.

Andrew Newell
Andrew Newell 2011년 2월 15일
There is also the Optimization Toolbox.

Graig
Graig 2011년 2월 15일
Thanks All. For me actually the 'quick and dirty' way works well, as the data are very smooth (not noisy). Seemed to me, this is what the black box 'findpeaks' contains in a better way.
  댓글 수: 1
Matt Tearle
Matt Tearle 2011년 2월 16일
To help others who might have the same question, it would be great if you could vote for and/or accept answers that you think should be given prominence. Thanks.

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

카테고리

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