Identifying periods of signal above threshold
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Antonio Morales
el 16 de Ag. de 2016
Editada: Antonio Morales
el 16 de Ag. de 2016
The code below provides number of "bursts" or periods of activity (300 consecutive points = 0.2 s) above a given threshold. How could I add a further condition to the code that identifies "bursts" only when there are at least n values of separation (i.e. 1200 points) (below the threshold) between two different bursts?
above_threshold = (signal > threshold);
minAcceptableLength = 300;
% Find spans that are long enough.
isLongEnough = bwareafilt(above_threshold, [minAcceptableLength, inf]);
% Count the number of spans (bursts) that are long enough.
[labeledSpans, numberOfBursts] = bwlabel(isLongEnough);
0 comentarios
Respuesta aceptada
Image Analyst
el 16 de Ag. de 2016
You'd have to look at the inverse: ~isLongEnough. Then call regionprops() to measure the lengths of all the stretches/gaps between the bursts. Then take some action depending on whether they are long enough or not.
labeledLowSignalRegions = bwlabel(~isLongEnough);
props = regionprops(labeledLowSignalRegions, 'Area');
allLengths = [props.Area]
1 comentario
Antonio Morales
el 16 de Ag. de 2016
Editada: Antonio Morales
el 16 de Ag. de 2016
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!