How can I apply median filter with sliding window for the ECG signal?

16 ビュー (過去 30 日間)
Dhiyaa Al-Shammari
Dhiyaa Al-Shammari 2019 年 11 月 25 日
コメント済み: Daniel M 2019 年 11 月 25 日
How can I apply median filter with sliding window n=200 ms and n=600 ms in Matlab fo a signalat sample rate 360 Hz?
load 100m.mat
figure(1);
plot(val)
x=medfilt1(val,200);
figure(2);
plot(x)
y=medfilt1(val,600);
figure(3);
plot(y)

回答 (1 件)

Daniel M
Daniel M 2019 年 11 月 25 日
編集済み: Daniel M 2019 年 11 月 25 日
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.
load 100m.mat
fs = 360; % Hz
t200 = 0:1/fs:0.2;
t600 = 0:1/fs:0.6;
figure(1);
plot(val)
x=medfilt1(val,length(t200)-1);
figure(2);
plot(x)
y=medfilt1(val,length(t600)-1);
figure(3);
plot(y)
  2 件のコメント
Dhiyaa Al-Shammari
Dhiyaa Al-Shammari 2019 年 11 月 25 日
Thanks alot dear brother
I think also the result of the x will be an input to the second medfilt1 as follow instead of putting val ine second filter I have put the variable x. Is that right ?
x=medfilt1(val,length(t200)-1);
y=medfilt1(x,length(t600)-1);
Daniel M
Daniel M 2019 年 11 月 25 日
x is already a median filtered version of val. If you want to filter it again, then use x as an input to medfilt1.

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

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by