Heart rate variability

Version 1.0.0 (273 KB) by Megha
The objectives of "Detection of heart rate variability from ECG signals Using MATLAB" project is to addresses the 1) Reading ECG Signal from
7 Downloads
Updated 30 Apr 2024

View License

The scope of the "Eye Detection Using MATLAB" project involves developing robust algorithms
for accurately detecting eyes in images, considering various factors such as lighting conditions,
facial expressions, and occlusions. The project encompasses algorithm development,
performance evaluation, optimization for computational efficiency, exploration of real-world
applications in fields like facial recognition and driver monitoring systems, thorough
documentation, scalability, and ethical considerations. Through comprehensive exploration
and implementation of these aspects, the project aims to deliver a reliable and versatile eye
detection system that can be applied in diverse scenarios while adhering to ethical principles
and ensuring privacy and fairness.
close all;
clc;
filename='100.dat';
fid=fopen(filename, 'r');
Fs=360;
f=fread(fid, 'ubit12');
ECG_signal=f(1:2:length(f));
t=(1:length (ECG_signal)/Fs);
[p,s,mu]=polyfit((1:numel(ECG_signal))', ECG_signal,6);
f_y=polyval(p, (1:numel (ECG_signal))',[],mu);
ECG_signal=ECG_signal-f_y;
segmentLength=900;
segment_advance=20;
pause_time=segment_advance/Fs;
figure;
distance=length (ECG_signal);
for i=7: (distance - 6)
ECG_signal (i)= sum(ECG_signal((i-6):(i+6)))/13;
end
for i=1:segment_advance:length (ECG_signal)-segmentLength
segment_point=i:(i+segmentLength-1);
segment=ECG_signal (segment_point);
plot (segment_point, segment, 'g');
set(gca, 'Color','k');
set (gof, 'color', [0 0.5 0.5]);
xlabel('Time');
ylabel('ECG Signal');
axis(i, i+segmentLength-1, -60, 1801);
hold on
grid on
[PKS, LOCS]=findpeaks (segment);
point=PKS>(mean (PKS) + 2*std(PKS));
PKS=PKS(point);
LOCS=LOCS(point);
peak_diff=diff(LOCS);
plot (segment_point, segment, segment_point(LOCS), PKS, 'rv', 'MarkerfaceColor','r');
BPM=60/(mean (peak_diff)/Fs);
beat_sound=audioread('beatbeat.wav');
soundsc(beat_sound);
if BPM>80
sound (segment, 10000,8);
end
title(['The Calculated Heart Rate is:' num2str(BPM) 'BPM']);
hold off;
pause (pause_time);
end

Cite As

Megha (2024). Heart rate variability (https://www.mathworks.com/matlabcentral/fileexchange/164846-heart-rate-variability), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: Heart Rate Variability Feature Set

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0