Filtering two channels ECG signals with sampling frequency of 1000 Hz using MATLAB

2 views (last 30 days)
Hello,
I have got my data set of values for Two Channels ECG Signals, but am new to MATLAB and i dont know how to filter it. I think i must be using Digital Signal Processing methods, because the data set are of discrete values (.mat tables)
Thanks

Answers (1)

Star Strider
Star Strider on 8 Aug 2016
The usual way of filtering EKG signals is to use a bandpass filter with a passband frequency of 2 to 100 Hz, and a stopband of 2 to 110 Hz. That should produce a stable filter. My filter design procedure is here: How to design a lowpass filter for ocean wave data in Matlab?
This designs a stable filter that should do what you want (eliminate base line wander and d-c offset, and high-frequency noise):
Fs = 1000; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [1.5 100]/Fn; % Normalised Passband
Ws = [0.1 120]/Fn; % Normalised Stopband
Rp = 20; % Passband Ripple (dB)
Rs = 30; % Stopband Ripple (dB)
[n,Wn] = buttord(Wp,Ws,Rp,Rs); % Filter Order
[b,a] = butter(n,Wn); % Filter Coefficients
[sos,g] = tf2sos(b,a); % Second-Order-Section For Stability
figure(1)
freqz(sos, 4096, Fs) % Filter Bode Plot
Use the filtfilt function with ‘sos’ and ‘g’ to filter your EKG signal.
  4 Comments
Mohanad Ahmed
Mohanad Ahmed on 9 Aug 2016
Am not really expert on this, but am still learning, I do have the two channels ECG signal data set (2x316000), plus ticktimes (1x316000) and range (1x316000) data sets. How can i filter the ECG signal out from this data ? i tried your code but it always gives me the same graph
Star Strider
Star Strider on 9 Aug 2016
I have no idea what your ‘ticktimes’ and ‘range’ data are or what you are doing.
I designed the standard EKG pre-processing filter everyone asks for, to filter out baseline offset and drift, and high-frequency noise. If your data have none of those, the output will be approximately the same as the input.
Your two-channel EKG data set are your EKG signals. There is nothing to ‘filter out’.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!