필터 지우기
필터 지우기

I would like to calculate heart rate by determining threshold for amplitude

조회 수: 2 (최근 30일)
I'd like to determing the QRS complex and draw rectange pulse and calculating hart rate
this code is what i write,
ecg =importdata ('ecg.txt');
sig=ecg(1:1400);
th=0.5;
count=0;
while (ecg> th)
count=count+1
end
  댓글 수: 3
mary keshtkar
mary keshtkar 2023년 3월 8일
I have no more information.
What if I just detect the QRS complex and count them?
Star Strider
Star Strider 2023년 3월 8일
See my Answer to your other Question. (There are still problems.)

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

답변 (1개)

Image Analyst
Image Analyst 2023년 3월 8일
Try this:
% Optional initialization steps
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
ecg = importdata ('ecg.txt');
% Plot it
hFig = figure('Name', "Mary's ECG Signal", 'NumberTitle','off');
plot(ecg, 'b-', 'LineWidth', 2);
grid on;
xlabel('Sample Number', 'FontSize',fontSize);
ylabel('Signal Value', 'FontSize',fontSize)
title("Mary's ECG Signal", 'FontSize',fontSize)
% Define threshold
threshold = 0.5;
% Draw red lines across the thresholds.
yline(threshold, 'Color','r', 'LineWidth', 2);
yline(-threshold, 'Color','r', 'LineWidth', 2);
% Detect samples above threshold
inAPositivePeak = ecg > threshold;
% Count the number of positive peaks using bwlabel() in the Image Processing Toolbox.
[~, numPositivePeaks] = bwlabel(inAPositivePeak)
% Detect samples below a threshold
inANegativePeak = ecg < -threshold;
% Count the number of positive peaks using bwlabel() in the Image Processing Toolbox.
[~, numNegativePeaks] = bwlabel(inANegativePeak)
numPositivePeaks =
67
numNegativePeaks =
67

카테고리

Help CenterFile Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by