How can I find the Q and S waves for this Particular ECG Data Set?

14 views (last 30 days)
I am having trouble finding the Q-waves for my ECG data set. Below is my code so far finding some of the other waves. Any help you can provide in finding the Q and S waves would be greatly appreciated
%% Load and read data file
clear
clc
load v5pat18.mat
ECG = amp;
%% Assign Variable Values
t = 1:length(ECG);
Fs = 500;
Fpass = 0.1; % Mean frquency of signal is 0.0656 --> round to 0.1
%% Creating lowband filter
smoothECG = lowpass(ECG,Fpass,Fs); % smooths out the graph to reduce noise
plot(t,smoothECG,'r',t,ECG,'b')
%% Finding
[Rx_Wave,location] = findpeaks(smoothECG,'MinPeakDistance',700);
[minP,loc1] = findpeaks(smoothECG, 'MinPeakHeight',0.01, ...
'MinPeakWidth',75,'MinPeakDistance',400);
[maxP,loc2] = findpeaks(smoothECG, 'MinPeakHeight',0.1, ...
'MinPeakWidth',75,'MinPeakDistance',400);
[C, ia] = setdiff(loc1, loc2, 'stable'); % stable due to order of values
% having significance
Px_Wave = [minP(ia); loc1(ia)];
P_Wave = Px_Wave(:,2:75);
R_Wave = Rx_Wave(:,[2:7,9:19,21:56,58:78])
X = location(:,[2:7,9:19,21:56,58:78])
plot(t,smoothECG, 'k',t(X),R_Wave,'vb')
hold on
plot(P_Wave(2,:),P_Wave(1,:), 'vr')
hold on

Accepted Answer

Star Strider
Star Strider on 22 Apr 2021
Assuming your EKG is Standard Lead II (we have no idea), the islocalmin function would likely work, however neither the Q or S deflections are necessarily visible in any given lead.
If you want to use findpeaks to locate them, since they are by definition negative deflections in Lead II, you would need to negate the signal (multiply it by -1) to find them.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!