How can I apply median filter with sliding window for the ECG signal?
31 views (last 30 days)
Daniel M on 25 Nov 2019
Edited: Daniel M on 25 Nov 2019
The second input of the function medfilt1 determines the window size.
% Y = MEDFILT1(X,N) specifies the order, N, of the median filter.
% For N odd, Y(k) is the median of X( k-(N-1)/2 : k+(N-1)/2 ).
% For N even, Y(k) is the median of X( k-N/2 : k+N/2-1 ).
In your case, the order will be however many samples it takes to 200 ms at 360 Hz. E.g. 0.600*fs = 216. Otherwise, it will be length(t)-1.
fs = 360; % Hz
t200 = 0:1/fs:0.2;
t600 = 0:1/fs:0.6;