How to Segment EMG data into time intervals

I have 2 minutes of filtered data that needs to be segmented into 20msec intervals, how would I go about doing that? It was collected at 2048 Hz and there is a total of 245762 data points.

 採用された回答

Star Strider
Star Strider 2021 年 2 月 25 日
編集済み: Star Strider 2021 年 2 月 25 日

0 投票

One option is the Signal Processing Toolbox buffer function.
It uses samples as one of its arguments, however that is straightforward to calculate:
Fs = 2048; % Sampling Frequency (samples/sec)
segment = 0.02; % Segments (20 ms)
Samples = round(Fs * segment); % Sample Length
I use round here, however fix, floor or ceil would also work, depending on what you want.

4 件のコメント

Ryan Chhiba
Ryan Chhiba 2021 年 2 月 25 日
So for the buffer fuction,
y = buffer (x,n,p)
x= emgsignal
n= _____
p= Samples
What would be n? 0.02 (20 ms)?
Star Strider
Star Strider 2021 年 2 月 25 日
Unless you want to overlap them (that is likely not desirable here), just use:
Fs = 2048; % Sampling Frequency (samples/sec)
segment = 0.02; % Segments (20 ms)
Samples = round(Fs * segment); % Sample Length
y = buffer(x,Samples);
or:
[y,z] = buffer(x,Samples);
depending on what you want to do, and want as a result, so ‘n’ is ‘Samples’ in my code.
Of interest, the documentation requires that ‘n’ is ‘positive real scalar’, so the functions creating it as an integer may not be required. I included those because I always specify ‘n’ as an integer.
Ryan Chhiba
Ryan Chhiba 2021 年 2 月 25 日
Okay, that makes more sense thank you!
Star Strider
Star Strider 2021 年 2 月 25 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

製品

リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by