Find the lowest values in vector array.

I would like to find only the lowest values in the vector and plot them along with origin signal. Here is what I did, but couldn't show the two lowest values in this example. So the goal is to find all lowest values. Not the maximum lowest one.
load('freeFall_1.txt')
freeFall=freeFall_1(:);
x=freeFall(1:100)
window_size2=4
simple2 = tsmovavg(x,'s',window_size2,1);
[M,I] = min(simple2,[],2)
figure(6)
plot(simple2)
hold on
plot(M,I,'o')

4 comentarios

Rik
Rik el 18 de Abr. de 2017
What do you mean with "all lowest values"? There is only 1 lowest value. Or do you mean the local minima?
Ahmed Mostfa
Ahmed Mostfa el 18 de Abr. de 2017
yes, all local minimum I need. How can I do it please?
Ahmed Mostfa
Ahmed Mostfa el 18 de Abr. de 2017
I only could found one value, how can I find all lower values?
Rik
Rik el 18 de Abr. de 2017
Maybe this answer on a similar question might help.

Iniciar sesión para comentar.

 Respuesta aceptada

Jan
Jan el 18 de Abr. de 2017
Do you have the Signal Processing Toolbox? Then:
[Minima, Index] = findpeaks(-simple2)

2 comentarios

It works, thanks a lot. I knew this function before, but the sign change it to lower minima. But the plot doesn't show me the points with the origin one. Best answer. Thanks for you again.
figure(6)
plot(simple2)
hold on
%plot(I,M)
[Minima, Index] = findpeaks(-simple2)
plot(Index,Minima,'*r')
Jan
Jan el 20 de Abr. de 2017
Editada: Jan el 20 de Abr. de 2017
[Minima, Index] = findpeaks(-simple2)
plot(Index, simple2(Index), '*r')
or
plot(Index, -Minima, '*r')

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 18 de Abr. de 2017

Editada:

Jan
el 20 de Abr. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by