MATLAB:滤除噪声EKG信号

kri*_*tia 7 matlab signal-processing filter

使用matlab 从ECG信号中去除噪声的最佳滤波器是什么?

Amr*_*mro 16

如果您可以访问信号处理工具箱,那么请查看Savitzky-Golay过滤器,即功能sgolay.有一个附带的演示,只需运行sgolaydemo.


以下是一个示例,显示了可以对信号应用滤波和去噪的各种方法.请注意,其中一些功能需要存在某些工具箱:

% load ecg: simulate noisy ECG
Fs=500;
x = repmat(ecg(Fs), 1, 8);
x = x + randn(1,length(x)).*0.18;

% plot noisy signal
figure
subplot(911), plot(x), set(gca, 'YLim', [-1 1], 'xtick',[])
title('noisy')

% sgolay filter
frame = 15;
degree = 0;
y = sgolayfilt(x, degree, frame);
subplot(912), plot(y), set(gca, 'YLim', [-1 1], 'xtick',[])
title('sgolayfilt')

% smooth
window = 30;
%y = smooth(x, window, 'moving');
%y = smooth(x, window/length(x), 'sgolay', 2);
y = smooth(x, window/length(x), 'rloess');
subplot(913), plot(y), set(gca, 'YLim', [-1 1], 'xtick',[])
title('smooth')

% moving average filter
window = 15;
h = ones(window,1)/window;
y = filter(h, 1, x);
subplot(914), plot(y), set(gca, 'YLim', [-1 1], 'xtick',[])
title('moving average')

% moving weighted window
window = 7;
h = gausswin(2*window+1)./window;
y = zeros(size(x));
for i=1:length(x)
    for j=-window:window;
        if j>-i && j<(length(x)-i+1) 
            %y(i) = y(i) + x(i+j) * (1-(j/window)^2)/window;
            y(i) = y(i) + x(i+j) * h(j+window+1);
        end
    end
end
subplot(915), plot( y ), set(gca, 'YLim', [-1 1], 'xtick',[])
title('weighted window')

% gaussian
window = 7;
h = normpdf( -window:window, 0, fix((2*window+1)/6) );
y = filter(h, 1, x);
subplot(916), plot( y ), set(gca, 'YLim', [-1 1], 'xtick',[])
title('gaussian')

% median filter
window = 15;
y = medfilt1(x, window);
subplot(917), plot(y), set(gca, 'YLim', [-1 1], 'xtick',[])
title('median')

% filter
order = 15;
h = fir1(order, 0.1, rectwin(order+1));
y = filter(h, 1, x);
subplot(918), plot( y ), set(gca, 'YLim', [-1 1], 'xtick',[])
title('fir1')

% lowpass Butterworth filter
fNorm = 25 / (Fs/2);               % normalized cutoff frequency
[b,a] = butter(10, fNorm, 'low');  % 10th order filter
y = filtfilt(b, a, x);
subplot(919), plot(y), set(gca, 'YLim', [-1 1])
title('butterworth')
Run Code Online (Sandbox Code Playgroud)

截图

  • 我知道这是一个古老的答案,但请记住,为了诊断表面心电图的准确性,需要保留非常具体的频率范围.具体来说,对于最高保真度的ST段应该保留0.05-1Hz,对于成人来说可能是低通40Hz,对于ECG的其余部分可能是150Hz(对于线路频率也适当的陷波滤波器) .我对Savitzky-Golay FIR并不熟悉,但应注意确保它保留心电图中的重要频率. (2认同)