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

조회 수: 1 (최근 30일)
%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
Cris LaPierre
Cris LaPierre 2023년 5월 16일
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 2023년 5월 16일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Cris LaPierre
Cris LaPierre 2023년 5월 16일
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.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by