필터 지우기
필터 지우기

Obtain Values Greater Than Threshold For a Duration

조회 수: 12 (최근 30일)
Ameen
Ameen 2022년 9월 20일
답변: Walter Roberson 2022년 9월 20일
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.

채택된 답변

Walter Roberson
Walter Roberson 2022년 9월 20일
%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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by