how to figure heart rate graph

9 visualizaciones (últimos 30 días)
Dominik Smolinsky
Dominik Smolinsky el 5 de En. de 2022
Comentada: Star Strider el 5 de En. de 2022
Hello guys.
I have ECG signal from which i have average heart rate using wavelet transform. Now, i need to figure heart rate graph, but i dont know how to do it. Can you help me? It should look like picture below.
My code:
%%
clc;
clear all;
close all;
%% Načítanie EKG signálu
[record,hdr] = edfread('EKG3.EDF');
farosEKG=record.ECG;
farosEKG = vertcat(farosEKG{1:end});
%%
fs = 200; % Vzorkovacia frekvencia
farosEKG = downsample(farosEKG,1000/fs); % Presamplovanie na požadovanú vzorkovaciu frekvenciu
pocet_vzorkov = 1:length(farosEKG); % Počet vzorkov signálu
vektor_casu = pocet_vzorkov./200; % Časový vektor
% 4 level undecimated DWT using sym4
vt = modwt(farosEKG,4,'sym4');
% Extracting d3 and d4 coeff.
wtrec = zeros(size(vt));
wtrec(3:4,:) = vt(3:4,:);
% Inverse DWT with d3 and d4 coeff.
y = imodwt(wtrec, 'sym4');
y = abs(y).^2; % Magnitude square
yavg = mean(y); % Average of y^2 as threshold
% Detecting Peaks
[R_peaks, locs] = findpeaks(y,pocet_vzorkov,'MinPeakHeight',8*yavg,'MinPeakDistance',50);
% Number of beats
n_beats = length(locs);
timelimit = length(farosEKG)/200;
% Heart rate BPM
bpm = (n_beats*60)/timelimit;
disp(strcat('Priemerná tepová frekvencia je : ',num2str(bpm)))
% Showing ECG signal and the detected R Peaks
subplot(211)
plot(vektor_casu,farosEKG);
xlim([0,timelimit]);
title('EKG signál');
hold on;
plot([timelimit/3, timelimit/3], [-6000, 10000], 'k');
plot([(timelimit/3)+(timelimit/3), (timelimit/3)+(timelimit/3)], [-6000, 10000], 'k');
text(89, 7000,'Rýchlosť - 4km/hod');
text(336, 7000,'Rýchlosť - 6km/hod');
text(581, 7000,'Rýchlosť - 8km/hod');
hold off;
subplot(212)
plot(pocet_vzorkov,y);
xlim([0,length(farosEKG)]);
hold on;
plot(locs,R_peaks,'ro');
title('Hľadanie peakov');
hold on;
plot([14.8e4/3, 14.8e4/3], [-0.5e7, 3e7], 'k');
plot([(14.8e4/3)+(14.8e4/3), (14.8e4/3)+(14.8e4/3)], [-0.5e7, 3e7], 'k');
text(1.8e4, 2.5e7,'Rýchlosť - 4km/hod');
text(6.7e4, 2.5e7,'Rýchlosť - 6km/hod');
text(11.8e4, 2.5e7,'Rýchlosť - 8km/hod');
hold off;
  3 comentarios
Dominik Smolinsky
Dominik Smolinsky el 5 de En. de 2022
I have an average heart rate in the part below, but now i need like heart rate graph and dont know how to do it.
% Number of beats
n_beats = length(locs);
timelimit = length(farosEKG)/200;
% Heart rate BPM
bpm = (n_beats*60)/timelimit;
disp(strcat('Priemerná tepová frekvencia je : ',num2str(bpm)))
Star Strider
Star Strider el 5 de En. de 2022
The R-R intervals will be in units of seconds/beat.
How would you convert that to beats/second, and then beats/minute?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre ECG / EKG en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by