How to find the mean peaks in positive axis

20 visualizaciones (últimos 30 días)
Star Rats
Star Rats el 6 de Oct. de 2019
Comentada: dpb el 7 de Oct. de 2019
I wish to find the mean of all peaks from the positive axis in Figure 1.
I tried
pks = findpeaks(y);
but it includes some negatif value.
How to filter out the nagative peaks and remain the positive peaks?

Respuesta aceptada

dpb
dpb el 6 de Oct. de 2019
Editada: dpb el 7 de Oct. de 2019
thresh=0; % or whatever level you wish
pks = findpeaks(y,'MinPeakHeight',thresh);
Read the doc carefully; findpeaks has all kinds of options you'll probably find useful.
  2 comentarios
Star Rats
Star Rats el 7 de Oct. de 2019
Editada: Star Rats el 7 de Oct. de 2019
Thanks @dpb
dpb
dpb el 7 de Oct. de 2019
NB I defined the variable threshold after first just typing in the '0' value...fixed up the Answer to reflect using the variable...dpb

Iniciar sesión para comentar.

Más respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 6 de Oct. de 2019
Hi,
Here is a simple and fast answer to peak only positive peaks of your data:
Y = DATA; % This is your data
X = findpeaks(Y);
X_pos = X(X>0); % Selects only positive peaks
Good luck

Community Treasure Hunt

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

Start Hunting!

Translated by