full width of a peak
Mostrar comentarios más antiguos
Hi, I have an eog signal which I want to know the duration of its blinks. I want to obtain starting and ending point of a peak , I have used findpeaks function but it gives halfheight width. how can I find full durations?
any help would be appreciated.Respuesta aceptada
Más respuestas (1)
Image Analyst
el 7 de Ag. de 2021
0 votos
Have you tried just locating the peaks, and then "falling down" the slope on each side until the signal turns around? This would work for smooth peaks but not those that had lots of little tiny "shoulder peaks" on the main peak, but I don't see any of those in your signal.
Attaching your signal in a .mat file would have been helpful, but you forgot.
2 comentarios
Mahsa Rm
el 7 de Ag. de 2021
Image Analyst
el 7 de Ag. de 2021
Editada: Image Analyst
el 7 de Ag. de 2021
Enclose your file in a .zip file and attach it with the paperclip icon. Something like (untested)
[peakValues, indexesOfPeaks] = findpeaks(y);
numPeaks = length(peakValues);
peakLeft = ones(1, numPeaks);
peakRight = ones(1, numPeaks);
% Find valley to the left of the peak
for k = 1 : numPeaks
for k2 = indexesOfPeaks(k) : -1 : 1
if y(k2) > y(k2+1)
break;
end
end
peakLeft(k) = k2;
end
% Find valley to the right of the peak
for k = 1 : numPeaks
for k2 = indexesOfPeaks(k) : length(y)
if y(k2+1) > y(k2)
break;
end
end
peakRight(k) = k2;
end
Now you have arrays giving the left and right indexes of the peaks.
Categorías
Más información sobre Descriptive Statistics en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
