Borrar filtros
Borrar filtros

Obtain Values Greater Than Threshold For a Duration

12 visualizaciones (últimos 30 días)
Ameen
Ameen el 20 de Sept. de 2022
Respondida: Walter Roberson el 20 de Sept. de 2022
Hello,
I have EMG data where I would like to see where the EMG is considered "Active". In order to be "Active" the signal must be above some threshold 'X' for 'Y' time points to be considered. (Ex. Above threshold value of 10 for at least 0.1 seconds). How may I find the indicies of values that are above the threshold for at least some given period of time.

Respuesta aceptada

Walter Roberson
Walter Roberson el 20 de Sept. de 2022
%Fs is sampling frequency, use your actual frequency instead of the
%hard-coded one I give here
Fs = 24000;
threshold_duration = 0.1;
threshold_number_samples = ceil(threshold_duration * Fs);
mask = X(:).' > threshold;
mask2 = true(1, threshold_number_samples);
starts = strfind([false, mask], [false, mask2]);
stops = strfind([mask, false], [mask2, false]);
%now each starts(K) : stops(K) is indices of data above the threshold for
%sufficiently long

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by