Can anyone help me run this code to detect the R peaks in my ecg signal and then modify it to obtain the bpm?

3 visualizaciones (últimos 30 días)
%clear stuff
clf
clear
clc
%Load the ECG/EKG data
EKG = load('Child_E1SISO.mat')
EKG = struct with fields:
Child_E1: [2500×1 double]
EKG_1 = EKG.val(1,:);
Unrecognized field name "val".
EKG_2 = EKG.val(2,:);
%time step vector
ts = (0:10/length(EKG_1):10-10/length(EKG_1));
%plot data
plot(ts, EKG_1)
hold on;
title('EKG Data (Channel 1)')
xlabel('Time (in seconds)')
ylabel('EKG amplitude')
%[PkAmp, PkTime] = findpeaks(Displacement)
[PkAmp, PkTime] = findpeaks(EKG_1, 'MinPeakHeight', 1100);
Actual_Time = PkTime/length(EKG_1);
I am trying to get the Rpeaks and then obtain the heart rate of the signal in bpm.
  2 comentarios
Cris LaPierre
Cris LaPierre el 16 de Mayo de 2023
Child_E1SISO.mat does not contain a variable named val, and the variable that it does contain (Child_E1) only has a single column of data.
Rafia Noshin
Rafia Noshin el 16 de Mayo de 2023
As far as i know this is the logic behind finding the bpm by detecting the R peaks first using the matlab built in function. Could you kindly tell me how to proceed otherwise? I want to find the Rpeaks and hence the bpm of this ecg file specifically.

Iniciar sesión para comentar.

Respuestas (1)

Cris LaPierre
Cris LaPierre el 16 de Mayo de 2023
I'd suggest doing this interactively in a live script using the Find Local Extrema live task. There, you can interactively adjust the settings until you obtain the points you want, and then either turn that into code, or just work with the output.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by