フィルターのクリア

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

2 ビュー (過去 30 日間)
mary keshtkar
mary keshtkar 2023 年 3 月 8 日
回答済み: Image Analyst 2023 年 3 月 8 日
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 Center および File ExchangeSignal Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by