Hello, fellow developers! I'm Krishanu Dev Sarma, and this repository houses my project for the study and implementation of a heartbeat detection technique from ECG signals using MATLAB. The primary focus is on signal processing techniques, including noise removal through low-pass and high-pass filters and R-peak detection.
- Data: The
database
folder contains sample ECG signals for testing. - Code: MATLAB scripts for signal processing and R-peak detection.
data_plot.m
: Loads the data and plots it in Matlab.Low_pass_filter.m
: Implements noise removal through low-pass filter.High_pass_filter.m
: Implements noise removal through high-pass filter.R_peaks.m
: Utilizes MATLAB for R-peak detection.Calculation_of_heart_rate.m
: Calculates the heart rates from the R-peaks.
- Baseline Wander: Low-frequency variations caused by body movements.
- Powerline Interference: High-frequency noise from power sources.
- Muscle Artifacts: High-frequency noise caused by muscle movements.
- Electrode Motion Artifacts: Abrupt changes due to electrode displacement.
-
Low-Pass Filter: Attenuates high-frequency noise, preserving the slower-changing ECG signal.
% Example code for low-pass filtering ecg_signal_lowpass = lowpass(ecg_signal, cutoff_frequency, sampling_frequency);
-
High-Pass Filter: Eliminates baseline wander and low-frequency noise.
% Example code for high-pass filtering ecg_signal_highpass = highpass(ecg_signal, cutoff_frequency, sampling_frequency);
MATLAB provides robust tools for peak detection. The findpeaks
function is particularly useful.
% Example code for R-peak detection
[peaks, locations] = findpeaks(ecg_signal, 'MinPeakHeight', threshold);
- Rich Signal Processing Toolbox: MATLAB's extensive toolbox simplifies signal processing tasks.
- Community Support: A large and active MATLAB community provides ample resources and solutions.
- Versatility: MATLAB is well-suited for prototyping and research in signal processing applications.
- Cost: MATLAB is a commercial software, and licensing costs can be a factor for some users.
- Learning Curve: For those unfamiliar with MATLAB, there might be an initial learning curve.
- Limited Parallel Processing: MATLAB's parallel processing capabilities are limited compared to some other languages.
- Understand ECG Signals: Gain a solid understanding of ECG signals and the nature of different types of noise.
- Optimize Filtering Parameters: Fine-tune filter parameters based on your specific signal characteristics.
- Explore MATLAB Documentation: MATLAB's documentation is a goldmine. Explore it for in-depth insights.
This project aims not only to detect heartbeats but to provide a learning platform for signal processing enthusiasts. Feel free to explore, experiment, and contribute. Let's keep the heartbeat of open source pulsating!
Happy coding! 🚀💓
Note: This readme page provides a high-level overview; specific technical details, code snippets, and results would be integrated into a comprehensive blog post for publication.