ECG signal artifact removing .

16 views (last 30 days)
@MSM
@MSM on 2 Nov 2017
Commented: Star Strider on 3 Nov 2017
I have ECG signal has .mat extension I want to make good Baseline wander artifact removing by code, I know how to make it by fdatool , I just want it by codes to enhance it more ?

Accepted Answer

Star Strider
Star Strider on 2 Nov 2017
Try this:
Fs = 1000; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = [1.1 100]/Fn; % Passband Frequency (Normalised)
Ws = [0.1 101]/Fn; % Stopband Frequency (Normalised)
Rp = 1; % Passband Ripple (dB)
Rs = 150; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = cheby2(n,Rs,Ws); % Filter Design
[sosbp,gbp] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
figure(3)
freqz(sosbp, 2^16, Fs) % Filter Bode Plot
filtered_signal = filtfilt(sosbp, gbp, original_signal); % Filter Signal
Tweak the filter characteristics (most notably ‘Fs’ to be appropriate to your signal) to get the result you want. The sampling frequency ‘Fs’ is ideally above 250 Hz to use this filter.
  8 Comments
@MSM
@MSM on 3 Nov 2017
Edited: Star Strider on 3 Nov 2017
thank you , but its give me error
the filter appearing but the signal not filtered appearing also
they are at same folder
Error in filterBW (line 12)
filtered_signal = filtfilt(sosbp, gbp, ***** ); % Filter Signal
Star Strider
Star Strider on 3 Nov 2017
It would help to know the complete text of the error message.
You cannot use ‘*****’ for your original (unfiltered) signal. You have to import it into your workspace (read it from the file), give it a variable name, and then supply that variable name to the filtfilt function to filter it.
See the documentation on Data Import and Analysis (link) and Supported File Formats for Import and Export (link) for a list of the functions you can use to import your data, depending on the file format it is currently in.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!