Borrar filtros
Borrar filtros

Findpeaks with multiple columns

7 visualizaciones (últimos 30 días)
HC98
HC98 el 14 de Feb. de 2022
Respondida: Star Strider el 16 de Feb. de 2022
So I have an array which is sized at 2000 x 100, called bdata. I want to use findpeaks to determine the peaks in every column of this array. I tried the following:
for g = 2:size(bdata,2)
[pk,loc] = findpeaks(bdata(:,g));
P{g} = [pk loc];
end
But it keeps calculating wrong values and even values not in bdata...
  2 comentarios
Mathieu NOE
Mathieu NOE el 14 de Feb. de 2022
hello
can you share the data as well and explain what you expect ?
Mathieu NOE
Mathieu NOE el 16 de Feb. de 2022
hello
so , problem solved ?

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 16 de Feb. de 2022
I am not certain what the data are, and without the data an appropriate solution is not possible.
However, there are two observations:
1. The findpeaks call in the question will return the indices of the peaks, not the independent variable value corresponding to those peaks. Finding that however is straightforward — simply use the ‘locs’ result to index into it.
2. The easiest way to be certain that findpeaks returns the desired peak is to use one or more of the name-value pair arguments. The one I use most is 'MinPeakProminence' since it invariably works and is relatively independent of the actual peak height. The 'MinPeakDistance' name-value pair can also help isolate the correct peak.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by