find local minima within a time window of interest
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Melissa Jones
il 11 Nov 2021
Risposto: Star Strider
il 11 Nov 2021
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?

0 Commenti
Risposta accettata
Star Strider
il 11 Nov 2021
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.
.
0 Commenti
Più risposte (1)
Yongjian Feng
il 11 Nov 2021
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 Commenti
Yongjian Feng
il 11 Nov 2021
Modificato: Yongjian Feng
il 11 Nov 2021
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>.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!