Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
mary keshtkar
mary keshtkar le 8 Mar 2023
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 commentaires
mary keshtkar
mary keshtkar le 8 Mar 2023
I have no more information.
What if I just detect the QRS complex and count them?
Star Strider
Star Strider le 8 Mar 2023
See my Answer to your other Question. (There are still problems.)

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 8 Mar 2023
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

Catégories

En savoir plus sur Signal Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by