RESPIRATION RATE AND HEART RATE DETECTION

Version 1.0.0 (1,7 ko) par Harshini
Real-time(phonocardiograph) plot which displays data from an electronic stethoscope via the COM port.
10 téléchargements
Mise à jour 27 avr. 2024

Afficher la licence

Respiration rate and heart rate detection are vital parameters in monitoring an individual's health. Respiration rate refers to the number of breaths taken per minute, reflecting the efficiency of oxygen exchange in the lungs. It's a crucial indicator of respiratory health, cardiac function, and overall well-being. On the other hand, heart rate, measured in beats per minute, indicates the frequency of heart contractions, reflecting cardiovascular health and exertion levels.
Detection methods vary, from traditional manual counting to modern technologies like wearable sensors and medical devices. These technologies utilize various principles such as photoplethysmography (PPG), which measures blood volume changes, and accelerometers to detect movement associated with breathing and heartbeats. Accurate detection and monitoring of these rates aid in diagnosing respiratory and cardiovascular disorders, assessing fitness levels, and guiding medical interventions. They play a pivotal role in preventive healthcare, enabling timely intervention and improving quality of life.
a = arduino('COM4','Due');
y=0;
hPlot = plot(NaN);
intervalSize = 200;
currentInterval = 200;
t = 1; % number of samples
atInterval = 1;
beat_count = 0;
quitbutton = uicontrol('style','pushbutton',...
'string','Quit', ...
'fontsize',12, ...
'position',[10,2,50,20], ...
'callback','quitit=1;close');
quitit = 0;
bpmtext = uicontrol('style', 'text',...
'string', ['BPM: '],...
'fontsize', 12,...
'position', [80, 2, 100, 20]);
while(1)
k = 1;
while(t<currentInterval)
b=readVoltage(a, 'A0');
y=[y,b];
if ishandle(hPlot)
set(hPlot, 'YData', y);
else
break; % break out of the loop
end
xlabel('Samples')
ylabel('Voltage')
title('Phonocardiogram')
axis([currentInterval - intervalSize,currentInterval,0,3]);
%grid
t=t+k;
pause(0.002)
end
for m = 2 : length(b)-1
if(b(m) > b(m-1) & b(m) > b(m+1) & b(m) > 2.4)
%disp('Prominant peak found');
beat_count = beat_count + 1;
set(bpmtext, 'string', ['BPM: ',...
num2str(BPM_avg,4)]);
end
end
currentInterval = currentInterval + intervalSize;
atInterval = atInterval + 1;
if ~ishandle(hPlot)
break;
end
fs = 500;
N = length(b);
duration_in_seconds = N/fs;
duration_in_minutes = duration_in_seconds/60;
BPM_avg = beat_count/duration_in_minutes;
end

Citation pour cette source

Harshini (2024). RESPIRATION RATE AND HEART RATE DETECTION (https://www.mathworks.com/matlabcentral/fileexchange/164591-respiration-rate-and-heart-rate-detection), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2024a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0