QRS area calculation from ECG
14 views (last 30 days)
Show older comments
Gültekin Günhan
on 5 Sep 2024
Answered: Gültekin Günhan
on 2 Oct 2024
Hello..There are several studies about calculating QRS area from ECG. They all cite MATLAB however, there is no script I can access from MATLAB...It is called custom MATLAB script but there are no details. I want to conduct a study about QRS area calculation with Kors conversion matrix.. I would be grateful if someone could show me the way for ECG analysis.
0 Comments
Accepted Answer
Star Strider
on 5 Sep 2024
II have heard of the Kors transformation matrix, however I have never used it. I just now did an Interweb search, and I was not able to find any available code for the Kors transformation matrix. (The articles that mention writing MATLAB code to calculate iit do not post the code.) I was also not able to find any mathematical description of it in the literature. If you have a source for the mathematical description of it, share it here, and I wiill giive a shot to coding it.
When I created a 3D vectorcardiogram here, I just used Lead I, Lead and Lead . That worked well enough to illustrate the concept.
Calculating the area will be relatively straightforward after doing the preliminary transformation calculations using the trapz function.
2 Comments
More Answers (3)
William Rose
on 6 Sep 2024
Edited: William Rose
on 6 Sep 2024
[Edit: Add a citation of, and link to, the original Kors paper. The data and matrix and code are unchanged.]
The Kors conversion matrix is a 12x3 matrix that converts a 12 lead EKG to the three components (X,Y,Z) of the vector cardiogram. It is
A=[ 0.38,-0.07, 0.11; -0.07, 0.93,-0.23; 0 , 0 , 0 ;...
0 , 0 , 0 ; 0 , 0 , 0 ; 0 , 0 , 0 ;...
-0.13, 0.06,-0.43; 0.05,-0.02,-0.06; -0.01,-0.05,-0.14;...
0.14, 0.06,-0.20; 0.06,-0.17,-0.11; 0.54, 0.13, 0.31]; % Kors
as you can see from Table 1 of Kors et al. (1990) and from Table 2 of Jaros et al. (2019). The order above assumes that the columns of the 12 lead EKG are
I, II, III, aVR, aVL, aVF, V1, V2, V3, V4, V5, V6.
The zeros in matrix A reflect the fact that leads III and aVR, aVL, aVF are not used by Kors.
Example, using 12 lead EKG recorded at 500 Hz by Perez Alday & Tereshchenko (2021), https://doi.org/10.13026/sm8m-v308:
ekg12=load('ecg12leadData.txt'); % load 12 lead EKG data
t=(0:length(ekg12)-1)/500; % time (s)
ekgV=ekg12*A; % compute vector cardiogram with Kors transformation
Plot leads I, II, III of the 12 lead EKG:
figure
subplot(311), plot(t,ekg12(:,1),'-k')
title('Lead I'); grid on
subplot(312), plot(t,ekg12(:,2),'-k')
title('Lead II'); grid on
subplot(313), plot(t,ekg12(:,3),'-k')
title('Lead III'); grid on; xlabel('Time (s)')
Plot leads X, Y, Z of the vector cardiogram:
figure
subplot(311), plot(t,ekgV(:,1),'-r')
title('X'); grid on
subplot(312), plot(t,ekgV(:,2),'-g')
title('Y'); grid on
subplot(313), plot(t,ekgV(:,3),'-b')
title('Z'); grid on; xlabel('Time (s)')
Save the vector cardiogram data with
% save("ecgXYZ","ekgV"); % save vector cardiogram to .mat file
which is commented out here, since it will not run in this online platform.
I will discuss the QRS area calculation in a comment.
1 Comment
William Rose
on 6 Sep 2024
I assume you are familiar with van Stipdonk et al. (2018), https://www.ahajournals.org/doi/epub/10.1161/CIRCEP.118.006497. It seems you may be trying to reproduce their analysis, since they compute QRS area from the vector cardiogram, which they obtain using the Kors transformation.
The QRS area is
where QRSarea,x (or y or z) is the total (absolute value) area between the respective trace (x, y, or z) and the baseline, during the QRS complex. The QRS start and end time are determined as described here (Zong et al., 2003). Zong et al. use a single lead EKG ("lead 0" in the MIT-BIH database). I assume this is lead II of a standard EKG. van Stipdonk et al. (2018) do not describe how they determine the baseline. I assume here that the baseline is zero for X, Y, and Z.
For the illustration below, I assume the QRS complex start time is 6.400 s and the QRS duration is 80 msec, which is in the normal range. I use the vector cardiogram data computed in my answer above.
data=load('ecgXYZ'); % load .mat file
ekgV=data.ekgV; % extract ekgV
t=(0:length(ekgV)-1)/500; % time vector (s)
t1=6.400; t2=6.480; % QRS start, end times (s)
baseline=[0,0,0]; % baseline for X,Y,Z; adjust as desired
x=ekgV(t>=t1 & t<=t2,1);
QRSax=trapz(abs(x-baseline(1))); % QRSarea,x
y=ekgV(t>=t1 & t<=t2,2);
QRSay=trapz(abs(y-baseline(2))); % QRSarea,y
z=ekgV(t>=t1 & t<=t2,3);
QRSaz=trapz(abs(z-baseline(3))); % QRSarea,z
QRSarea=sqrt(QRSax^2+QRSay^2+QRSaz^2); % QRS area
fprintf('QRS area=%.1f.\n',QRSarea)
Plot the X, Y, Z components and the QRS boundaries.
figure
subplot(311), plot(t,ekgV(:,1),'-r'); hold on
title('X'); grid on; xlim([6 7]); xline(t1); xline(t2)
subplot(312), plot(t,ekgV(:,2),'-g'); hold on
title('Y'); grid on; xlim([6 7]); xline(t1); xline(t2)
subplot(313), plot(t,ekgV(:,3),'-b'); hold on
title('Z'); grid on; xlim([6 7]); xline(t1); xline(t2)
xlabel('Time (s)')
OK
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!