Finding RRI fluctuations (ECG) in 1s windows
1 view (last 30 days)
This is the code I am running.
sf = 399.0698; %sampling frequency (Hz), samples per second
T = 1/sf;
timeSeries = T:T:600.8122;
%y filtered data
d = designfilt('lowpassfir', ...
y = filtfilt(d,interictal_segment_1.data(1,:));
%findpeak for y signal in row 1
[pks,locs] = findpeaks(y(1,:),'MinPeakDistance',0.3);
I have found the local max for my signal y(1,:). However i would like to find fluctuations in the signal for successive 1 second, non-overlapping windows. Supposed that peaks 1,2,3,4 are successive local max.
fluctuations are counted for a total length of 1 second and data is kept in window.1. Repeat for another 1s and keep data in window.2.
I am new to Matlab so any help is appreciated. Thank you.
Peng Li on 10 Aug 2020
Your question isn't quite clear. If you want to get fluctuations of subsequent points in a time series as you described above, you can use diff function to do the first order difference, or simply using locs(2:end) - locs(1:end-1) (locs in the variable you defined in your program).
The thing that is confusing is that you are trying to get RRI within a 1-s window. That doesn't make a lot of sense as usually the heart beats about once, or a bit more than twice per second when people exercise. You are not able to get any fluctuations from a single heart beat.