Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heart Rate Variability Analysis for Cardiac Rhythm Discrimination

MATLAB-based analysis of time-domain heart rate variability metrics from MIT-BIH Arrhythmia Database records to explore differences between normal and pathological cardiac rhythms.

Overview

Heart rate variability (HRV) describes the variation in time between consecutive heartbeats. Even when two ECG recordings have a similar mean RR interval, their beat-to-beat variability may reveal important differences in cardiac rhythm.

This project implements a MATLAB workflow for extracting time-domain HRV features from annotated ECG records and exploring their ability to distinguish normal from pathological cardiac rhythms.

The analysis was developed in two stages:

  1. Comparison of two individual ECG records.
  2. Automated analysis of a larger collection of records.

The objective is exploratory signal analysis and visual discrimination rather than the development of a clinical diagnostic system.

Dataset

The ECG signals used in this project were obtained from the MIT-BIH Arrhythmia Database.

Individual-record analysis

The first stage compares two selected records:

  • Record 100
  • Record 208

The original ECG records were prepared as MATLAB .mat files containing the annotations, R-peak locations, beat types and sampling-frequency information required by the analysis.

Multi-record analysis

The second stage automatically processes 48 records classified into several rhythm categories:

  • Normal sinus rhythm (NSR)
  • Atrial fibrillation (AFIB)
  • Paced rhythm (PACED)
  • Complex supraventricular arrhythmias (ARRH_S_COMPLEX)
  • Complex ventricular arrhythmias (ARRH_V_COMPLEX)

Although the original assignment proposed using a representative sample of 10 records, the implemented workflow was extended to analyse 48 records.

Methodology

The processing pipeline follows these steps:

  1. Load the ECG annotations and R-peak locations.
  2. Select beats annotated as normal (N).
  3. Calculate RR intervals from consecutive R peaks.
  4. Convert the intervals from samples to seconds using the sampling frequency.
  5. Apply a physiological filter between 0.3 and 1.8 seconds.
  6. Extract time-domain HRV metrics.
  7. Organise the results in MATLAB tables.
  8. Represent the records in the SDNN–RMSSD feature space.

Extracted HRV Features

Mean RR Interval

The mean duration between consecutive valid R peaks.

SDNN

The standard deviation of the RR intervals, used as a measure of global heart rate variability.

RMSSD

The root mean square of successive RR-interval differences, used to measure short-term beat-to-beat variability.

Project Structure

heart-rate-variability-analysis/
│
├── README.md
├── LICENSE
├── .gitignore
│
├── src/
│   ├── analyze_single_records.m
│   └── analyze_record_dataset.m
│
├── data/
│   └── README.md
│
└── results/
    ├── README.md
    └── figures/
        ├── README.md
        ├── single_record_comparison.png
        └── healthy_vs_pathological_scatter.png

Results

Individual-Record Comparison

The analysis successfully processed:

  • Record 100: 2,238 valid RR intervals
  • Record 208: 1,253 valid RR intervals

The extracted time-domain HRV metrics were:

Record Classification Mean RR (s) SDNN (s) RMSSD (s)
100 Normal rhythm 0.80667 0.10069 0.13341
208 Pathological rhythm 0.92860 0.41709 0.59965

Although both records have relatively similar mean RR intervals, record 208 presents substantially higher SDNN and RMSSD values, indicating greater beat-to-beat variability.

Single-record HRV comparison

Multi-Record Analysis

The automated workflow analysed all 48 selected records:

  • 40 records produced valid HRV metrics.
  • 8 records contained no valid RR intervals after selecting beats annotated as N and applying the physiological filter.
  • Records without valid intervals were retained in the output tables with NaN values and an explanatory processing status.

The SDNN–RMSSD representation shows that many pathological records present greater variability. However, there is also visible overlap between normal and pathological groups.

Healthy and pathological HRV records

These results show that Mean RR, SDNN and RMSSD are useful for exploratory rhythm analysis, but they are not sufficient by themselves to classify every cardiac rhythm reliably.

Limitations

  • Only three time-domain HRV features are analysed.
  • Different pathological rhythm categories are grouped together in the final visual comparison.
  • Some records may contain too few valid RR intervals after filtering.
  • The separation between normal and pathological rhythms is not complete.
  • No automatic machine-learning classifier is trained.

Future improvements could include additional time-domain, frequency-domain and nonlinear HRV features, together with supervised classification algorithms.

Requirements

  • MATLAB
  • Prepared .mat files derived from the MIT-BIH Arrhythmia Database

Authors

  • Miguel Martín Domínguez
  • Adriana Moreno Naranjo

Originally developed jointly with Adriana Moreno Naranjo as a Biomedical Engineering academic project.

About

MATLAB-based analysis of time-domain heart rate variability metrics from MIT-BIH Arrhythmia Database records to explore differences between normal and pathological cardiac rhythms.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages