MATLAB Answers

ECG downsampling while prevending aliasing

20 views (last 30 days)
Thanos
Thanos on 11 May 2017
Commented: Star Strider on 11 May 2017
Hello everyone,
I have an ECG signal, sampled with an Fs of 44100 samples per second and the size of my signal is 2154163 samples. My signal contains artificial noise as can be seen in the 2 figures I attach (first figure is a part of my FFT results and second figure a zoom at the low frequencies). My task is to properly filter the signal so I can extract a heartbeat estimation. My first thought was to develop some notch filters but it is almost impossible to construct a steady filter for that low frequencies with such a huge sampling rate, so I guess some downsampling would be necessary. I read this article "https://www.mathworks.com/help/signal/ug/downsampling-aliasing.html" but it didn't really help me to actually implement the proper downsampling.. I also tried the "decimate" function of matlab but I noticed that it doesn't work as I would expect.. I would appreciate any kind of help or any idea on how to proceed..
Thanks a lot!

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 11 May 2017
A good choice for the ‘new’ sampling frequency is 250 Hz, although any frequency in the range of 250 to 1000 Hz will work. The bandwidth of a normal EKG is about 50 Hz, but any abnormalities increase the bandwidth to 100 Hz. A sampling frequency of 250 Hz or higher results in a Nyquist frequency of at least 125 Hz, so you can effectively filter your resampled EKG with a sampling frequency of 250 Hz.
I would use the Signal Processing Toolbox resample function, since it does everything you want.
Example
[p,q] = rat(250/44100);
EKG_New = resample(EKG_Original, p, q);
Any filter design (Chebyshev, Butterworth) should work. If you want to design a notch filter, I would use a Chebyshev design, since it produces a short, efficient, filter with short transition regions. Also see Remove the 60 Hz Hum from a Signal (link) for a relevant example.

  4 Comments

Show 1 older comment
Star Strider
Star Strider on 11 May 2017
My pleasure!
The noise appears to be broadband, so the only option is a wavelet denoising approach. The Wavelet Toolbox has a denoising demo. (I am not yet sufficiently proficient with wavelets to be able to help you with them.) Frequency-selective filters are not effective for dealing with broadband noise.
Thanos
Thanos on 11 May 2017
I have used wavelets in the past and something like that returns relatively satisfactory results.. :
%
deb = ECG(1);
scal = 'mln'; % level-dependent estimation of the level noise
xd = wden(ECG-deb,'sqtwolog','s',scal,3,'db6')+deb;
Thank you very much! :)
Star Strider
Star Strider on 11 May 2017
As always, my pleasure!
I’m re-learning wavelets after not having worked with them in many years. The Daubechies 6 is a good choice for denoising.

Sign in to comment.

More Answers (0)