find local minima within a time window of interest

조회 수: 3 (최근 30일)
Melissa Jones
Melissa Jones 2021년 11월 11일
답변: Star Strider 2021년 11월 11일
To do the plot I have the X values and the Y values.
I need to find the local minima within a specific time-window (250-350) in the x axes.
How can I do it?

채택된 답변

Star Strider
Star Strider 2021년 11월 11일
To find the minimum using findpeaks, multiply the first argument (‘y’) by -1 so the minimum becomes a maximum. Do not use the second argument as ‘x’ so that ‘locs’ returns an index. Then, use the ‘locs’ output with the original ‘x’ and ‘y’ vectors to get those values.
.

추가 답변 (1개)

Yongjian Feng
Yongjian Feng 2021년 11월 11일
You first need to figure out idx range of X for 250-350. Called them idx_start and idx_end.
Then just
min(Y(idx_start:idx_end))
  댓글 수: 4
Yongjian Feng
Yongjian Feng 2021년 11월 11일
편집: Yongjian Feng 2021년 11월 11일
Try this:
idx_start = find(X>=250, 1);
idx_end = find(X>=350, 1);
Adjust the condition above whether you want X>= or just X>.
Melissa Jones
Melissa Jones 2021년 11월 11일
Thank you Yongjian, but i need to use the find_peaks function

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

카테고리

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