how can i remove Baseline wander of an ECG signal by two-stage moving-average filter?
6 views (last 30 days)
Show older comments
i have an ECG siganl
fs = 360Hz
the first and second-stage averaging window
lengths are set to be 1/3 and 2/3 of the length of the
input signal in samples.
0 Comments
Accepted Answer
William Rose
on 7 Dec 2021
At each point, you replace the original signal with the orignal signal minus the moving average of the signal in that neighborhood.
If x(k)=original signal, k=1..N, and h(k)=moving average filter, k=1..M (where M is odd and M<N),
then you can make a new signal y(k):
y(k)=x(k)-sum{j=-(M-1)/2...+(M-1)/2 of h(j)*x(k+j)}
You'll have to do something at the edges to avoid issues.
4 Comments
William Rose
on 7 Dec 2021
@Naor p, You are welcome.
@Star Strider is correct (as always) that the usual way to remove baseline wander is with a "standard" high-pass filter. Subtracting the moving average IS a form of high-pass filtering, but it is not standard. I can't see Star Strider's answer now. It was a good answer.
Star Strider
on 7 Dec 2021
Thank you!
I removed it because it didn’t address the ‘moving average’ issue. (It exists plentifully elsewhere, since that’s my usual approach to these problems.)
Also, @Naor p needs to Accept your Answer because it correctly addreses the baseline filtering problem using the requested approach. (That’s the other reason I reomoved mine.) I’m voting for it in the interim.
.
More Answers (0)
See Also
Categories
Find more on Digital Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!