FIR Filter For ECG Signal Filtering
FIR Filter For ECG Signal Filtering
Abstract- In this study, we present a comprehensive approach information. Common sources of noise include baseline
to generating and processing realistic electrocardiogram (ECG) wander caused by respiratory movements, muscular noise
signals while addressing common noise artifacts encountered in arising from body movements, and power line interference
clinical settings. We simulated a standard ECG waveform
from the electrical grid. These artifacts complicate the
using Gaussian pulses to accurately model the PQRST
morphology, integrating heart rate variability through
analysis and interpretation of ECG signals, necessitating the
sinusoidal modulation. To emulate real-world conditions, implementation of robust signal processing techniques to
various noise types were introduced, including baseline enhance their quality.
wander, muscle noise, power line interference, and white
measurement noise. An FIR single pass-band filter designed In this study, we propose a comprehensive framework for
using a Hanning window was employed to mitigate these simulating realistic ECG signals while incorporating
disturbances effectively, preserving the integrity of the ECG physiological variability, followed by advanced filtering and
signal. The performance of the filtering technique was smoothing techniques to improve signal fidelity. A key
evaluated using several metrics: Mean Squared Error (MSE),
component of our approach is the design of a finite impulse
Signal-to-Noise Ratio (SNR), Peak Signal-to-Noise Ratio
(PSNR), and Root Mean Square Error (RMSE). Additionally, response (FIR) filter using a Hanning window. The Hanning
the Savitzky-Golay filter was applied for further smoothing of window is particularly effective due to its ability to
the processed signal. Results demonstrate significant minimize spectral leakage, which can occur during signal
improvements in the quality of the ECG signal after filtering, processing. Unlike rectangular windows, which can
highlighting the effectiveness of the proposed methods in introduce significant side lobes in the frequency domain, the
enhancing ECG signal fidelity. The frequency response of the Hanning window provides a smoother transition at the
designed FIR filter was analyzed to ensure optimal edges, thus preserving the integrity of the signal's spectral
performance within the specified pass-band. This work content. This characteristic makes it an optimal choice for
contributes to the field of biomedical signal processing by
providing robust techniques for ECG signal enhancement,
applications where maintaining frequency information is
which are crucial for accurate diagnosis and monitoring in critical, such as in ECG analysis.
cardiac healthcare.
Keywords – multi-band FIR filter, Hanning window, signal to Moreover, we employ smoothing techniques, specifically
noise ratio, mean squared error, fast Fourier transform, the Savitzky-Golay filter, which enhances the filtered signal
frequency response by fitting successive sub-sets of adjacent data points with a
low-degree polynomial. This method not only reduces high-
I. INTRODUCTION frequency noise but also preserves important features of the
Electrocardiography (ECG) is a critical non-invasive ECG waveform, such as the P, Q, R, S, and T peaks, which
diagnostic tool that records the electrical activity of the heart are vital for clinical diagnosis. By effectively mitigating
over time. This physiological monitoring technique provides noise while retaining the original signal's morphology, the
clinicians with invaluable information regarding cardiac Savitzky-Golay filter plays a crucial role in enhancing the
health, including the heart's rhythm, rate, and electrical overall interpretability of the ECG signal.
conduction pathways. By capturing the characteristic
PQRST waveform, healthcare professionals can identify a In summary, this research highlights the significance of
range of cardiovascular conditions, from arrhythmias to accurate ECG signal processing, presenting an integrated
ischemic heart diseases. The accuracy and reliability of ECG approach that combines signal simulation, noise
interpretation are paramount, as misdiagnosis can lead to introduction, FIR filtering with a Hanning window, and
inappropriate treatment strategies and potentially polynomial-based smoothing. The findings aim to improve
detrimental patient outcomes. diagnostic capabilities in cardiovascular care by ensuring
high-quality ECG recordings that can be reliably analysed
Despite its importance, the ECG signal is often plagued by by healthcare professionals.
various types of noise and artifacts, which can significantly
degrade signal quality and obscure vital diagnostic
Hanning Window Fig 3. FFT of single pass band Passed ECG Signal
2 πn
w[n] = 0.5 (1−cos( )) for 0≤n≤N−1
N −1
Hamming Window
2 πn
w[n] = 0.54−0.46 cos( ) for 0≤n≤N−1
N −1
Blackmann Window
2 πn 4 πn Fig 4. FFT of single pass band after smoothening
w[n] = 0.42−0.5 cos( ) + 0.08 cos( )
N −1 N −1
for 0≤n≤M−1
Kaiser Window
√ ( )
2
2n
1− −1
w[n]=I0(πβ N−1 )
I 0 ( πB)
for 0≤n≤M−1
Miscellaneous
60
RR interval =
Heart Rate
−¿¿
y(t)=A⋅ e
A is the amplitude, μ is the mean, which defines the
centre of the peak,
σ is the standard deviation, which controls the width of
the wave and t is the time variable. Fig 5. Frequency response of proposed FIR filter
P signal
SNR=10 log10( )
P noise
2
I
PSNR=10log10( max ) here Imax is max possible value
MSE
N
1
MSE = ∑
N n =1
(original−noise signal )2
RMSE = √ MSE
Fig 6. Time Domain Analysis of original ECG signal and Fig 7. Time Domain Analysis of band pass and band pass
noisy ECG signal with Savitzky-Golay smoothening (Proposed approach)
In selecting the best window function for our project, we though adjustable, introduces unnecessary complexity and
found that the Hanning window offered the most balanced requires tuning to achieve similar performance. In
performance between frequency resolution and side-lobe contrast, the Hanning window offers a practical balance
attenuation. The Hanning window provides a narrow main between resolution and leakage reduction, making it the
lobe, ensuring good frequency resolution to distinguish most suitable choice for our needs.
closely spaced frequency components, while its side-lobe
attenuation of -31 dB effectively reduces spectral leakage. IV. FUTURE SCOPE
This moderate attenuation significantly improves upon the
rectangular window, which has very poor leakage In the future, the functionality of applying window
suppression (-13 dB), despite its slightly narrower main functions such as the Hanning window can be developed
lobe. Compared to the Hamming window, which offers and implemented on hardware platforms like the Spartan-
better side-lobe suppression (-41 dB), the Hanning 6 FPGA for real-time signal processing applications.
window was chosen for its consistency and simplicity, Leveraging the parallel processing capabilities and high-
performing well across a wide range of signals without speed performance of FPGAs, the windowing operation
needing adjustments. While the Blackman window can be optimized for low-latency and high-throughput
delivers excellent side-lobe attenuation (-58 dB), it comes systems. By designing efficient hardware architectures,
at the cost of a much wider main lobe, reducing its ability such as using multipliers and adders in pipeline stages, the
to resolve closely spaced frequencies. The Kaiser window, window function can be applied directly to incoming
signal data streams, allowing for real-time spectral based on a thorough understanding of the trade-offs
analysis in applications like communications, radar, and associated with each window function and how they
audio processing. Additionally, implementing the impact the overall spectral analysis.
windowing function in hardware will allow for further
optimizations, such as dynamic window selection or VI. ACKNOWLEDGMENTS
adjustable window parameters, which can be controlled We would like to thank our college, Vishwakarma
through software interfaces. This approach would Institute of Technology, Pune and Prof. Milind Tirmare
significantly enhance the system’s capability to handle for giving us the opportunity to study and design a FIR
large datasets in real-time and broaden its application in (Finite Impulse Response) filter for an ECG signal to
fields requiring high-performance DSP (Digital Signal understand the real-life application this concept. We
Processing). would also thank the Electronics department for helping
us understand each component and helping us integrate
V. CONCLUSION them into our project.
In conclusion, this project has provided a comprehensive
analysis of different window functions, evaluating their
performance in terms of spectral leakage reduction and VIII. REFERENCES
frequency resolution. We explored the characteristics of [1] Reduction of power line interference in ECG Signal
using FIR filter. International Journal of
several widely used windows, including the Rectangular, Computational Engineering Research 2014
Hanning, Hamming, Blackman, and Kaiser windows, and
compared their main lobe width and side-lobe attenuation. [2] A Survey of noise removal techniques for ECG
Through this evaluation, we determined that the Hanning signals
window offers the best balance between minimizing International Journal of Advanced Research in
Computer and Communication Engineering 2013.
spectral leakage and preserving adequate frequency
resolution, making it the most appropriate choice for our
[3] Certain Investigation on hybrid Neural network
signal processing needs. method for classification of ECG signal with FIR
By selecting the Hanning window with multi passband, filter. Scientific Filters 2024.
we achieved a solution that balances good frequency
resolution and moderate side-lobe suppression, making it [4] Interference reduction in ECG signal using Digital FIR
filters based on rectangular window. WSEAS
a practical and effective choice for most real-world signal transaction on signal processing, 2018.
processing tasks. This decision was based on a thorough
understanding of the trade-offs associated with each [5] Removal of noise from ECG using Digital FIR and IIR
window function and how they impact the overall spectral filters with Various methods IEEE Xplore 2015.
analysis. The results of this project underscore the
importance of selecting the appropriate windowing [6] The comparison features of ECG Signal with
Different sampling frequencies and filter methods for
function for specific applications and provide valuable real time measurement. Symmetry journal 2021.
insights into the impact of these choices on signal analysis
outcomes. Ultimately, this project has deepened our [7] The use of FIR filter for filtering of ECG signal and
understanding of window functions, highlighting the Comparison of some parameters. International
Journal of Engineering Science Invention 2017.
importance of a balanced approach to reducing spectral
leakage while maintaining resolution in the frequency
domain.-world signal processing tasks. This decision was