Skip to content

KrishanuDevSarma/Implementation-of-Heartbeat-Detection-Technique-from-ECG-Signal-using-ML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ECG Heartbeat Detection Project

Overview

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.

Project Structure

  1. Data: The database folder contains sample ECG signals for testing.
  2. 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.

Technical Details

Types of Noises in ECG Signal

  1. Baseline Wander: Low-frequency variations caused by body movements.
  2. Powerline Interference: High-frequency noise from power sources.
  3. Muscle Artifacts: High-frequency noise caused by muscle movements.
  4. Electrode Motion Artifacts: Abrupt changes due to electrode displacement.

Noise Removal Technique

  1. 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);
  2. 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);

R-Peak Detection Using MATLAB

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);

Pros and Cons of MATLAB

Pros:

  1. Rich Signal Processing Toolbox: MATLAB's extensive toolbox simplifies signal processing tasks.
  2. Community Support: A large and active MATLAB community provides ample resources and solutions.
  3. Versatility: MATLAB is well-suited for prototyping and research in signal processing applications.

Cons:

  1. Cost: MATLAB is a commercial software, and licensing costs can be a factor for some users.
  2. Learning Curve: For those unfamiliar with MATLAB, there might be an initial learning curve.
  3. Limited Parallel Processing: MATLAB's parallel processing capabilities are limited compared to some other languages.

Advice for Developers

  1. Understand ECG Signals: Gain a solid understanding of ECG signals and the nature of different types of noise.
  2. Optimize Filtering Parameters: Fine-tune filter parameters based on your specific signal characteristics.
  3. Explore MATLAB Documentation: MATLAB's documentation is a goldmine. Explore it for in-depth insights.

Conclusion

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.