How could I create a sliding window of 300 seconds, with an overlap of 60 seconds?

1 回表示 (過去 30 日間)
Francesca Onofri
Francesca Onofri 2018 年 6 月 29 日
コメント済み: Walter Roberson 2020 年 5 月 23 日
I have a Ecg signal. I need to process it with consecutive windows of 5 minutes, and a overlap of 1 minute.(it's like first array from 1 to 300, second one from 61 to 361, third from 121 to 421..) My Ecg has a 250 Hz sample frequency. This is my code, but it doesn't work as i would:
N2=length(ECG);
fs=250; % sample freq
smp2=1:1:N2;
tmp2=smp2*(1/fs); % time array in seconds
h=1; %1 min
w=300*fs; %5 mins
for %%%here is missing something but i don t understand what is it
tmp_prova=tmp2(h:w);
h=h+60*fs;
w=w+(60*fs);
end
  1 件のコメント
JAYANTH BHIMAVARAPU
JAYANTH BHIMAVARAPU 2018 年 6 月 29 日
Hey... if you say first array is from 1 to 300 and second one from 61 to 360 , So you will have an overlap of 300-60 i.e 240. Think about this

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

回答 (3 件)

JAYANTH BHIMAVARAPU
JAYANTH BHIMAVARAPU 2018 年 7 月 2 日
編集済み: JAYANTH BHIMAVARAPU 2018 年 7 月 2 日
for i = 0:60:length(ECG)-300
temp = ECG(i+1 : 300 + i)
end
  6 件のコメント
Hemen Gogoi
Hemen Gogoi 2020 年 5 月 23 日
If i want to execute the same operation for 500 columns then what should be the modification in the code
Walter Roberson
Walter Roberson 2020 年 5 月 23 日
https://www.mathworks.com/matlabcentral/answers/408053-how-could-i-create-a-sliding-window-of-300-seconds-with-an-overlap-of-60-seconds#comment_584713 I show the modification for 500

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


MUHAMMED IRFAN
MUHAMMED IRFAN 2018 年 6 月 29 日
Does this help?
for i = 1 : 60: length(fullsignal)
current_signal = fullsignal( i : (i + 300-1))
end

Image Analyst
Image Analyst 2018 年 6 月 29 日
If you have the Image Processing Toolbox, you can use blockproc(). Demo attached above.

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by