# Detecting peaks with a specified range of amplitudes?

1 visualización (últimos 30 días)
HC98 el 9 de Feb. de 2023
Comentada: Luca Ferro el 27 de Feb. de 2023
Say i have a signal with range betwene [-3, 3] and I want to locate peaks within an amplitude range of say [0, 1], how might I do this? I.e., detect peak amolitudes within a given boundary of allowed amplitude values?
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (1)

Luca Ferro el 9 de Feb. de 2023
Editada: Luca Ferro el 9 de Feb. de 2023
if you need the range [0 1] just filter it out of the resulting vector afterwards, for example.
[pks,locs] = findpeaks(PeakSig,x); %peakSgn = the signal you want to analyze, x = the linspace you are working on
upperBound= locs > 0;
lowerBound= locs < 1;
peaksInRange= locs.*upperBound.*lowerBound
or more in a more compact way:
[pks,locs] = findpeaks(PeakSig,x); %peakSgn = the signal you want to analyze, x = the linspace you are working on
peaksInRange= (locs > 0 & locs < 1).*locs;
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Luca Ferro el 27 de Feb. de 2023

Iniciar sesión para comentar.

### Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

R2022b

### Community Treasure Hunt

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

Start Hunting!

Translated by