butterworth and baseline removal filtering
13 views (last 30 days)
Show older comments
Hello. I want to apply butterworth and baseline wandering removal filter on ECG signal. I searched mathworks and found this solution;
does anybody knows what are this variables? such as{ a, b ,Wn , N }
and why the formula of Wn is diffrent :Wn = 12*2/f and Wn=[f1 f2]*2/fs ?
I didn't understand the meaning of the comments
% ======================= start filtered ============================= %%
Wn = 12*2/fs;
N = 3; % order of 3 less processing
[a,b] = butter(N,Wn,'low'); % bandpass filtering
ecg_l = filtfilt(a,b, signal);
%%%% baseline wander filter
f1=0.5; % cuttoff low frequency to get rid of baseline wander
f2=15; % cuttoff frequency to discard high frequency noise
Wn=[f1 f2]*2/fs; % cutt off based on fs
N = 3; % order of 3 less processing
[a,b] = butter(N,Wn); % bandpass filtering
ecg_new = filtfilt(a,b, signal);
0 Comments
Answers (1)
Star Strider
on 23 Feb 2023
Edited: Star Strider
on 23 Feb 2023
The ‘baseline wander filter’ is a bandpass filter with a passband of 0.5 to 15 Hz. (This is too restrictive in my opinion. The upper passband should likely be about 45 Hz.)
Also, if you design such a filter, the appropriate butter call is:
[z,p,k] = butter(n,Wn);
[sos,g] = zp2sos(z,p,k);
(to be certain that the filter is stable, use zp2sos to create a second-order-section implementation), then:
ecg_filt = filtfilt(sos, g, signal);
to filter it.
EDIT — Corrected typographical errors.
.
0 Comments
See Also
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!