Plot 12-leads ECG signal in one figure

23 views (last 30 days)
Elzbieta
Elzbieta on 13 Nov 2024 at 15:20
Commented: Star Strider on 13 Nov 2024 at 18:32
Hello,
How to plot 12-leads ECG signal in one figure?
The ECG data are included in the structure:
% Create a structure to hold the ECG data
N = size(rawData,1)
ecgData = struct();
ecg = struct();
% Therefore
ecgData.leadI=rawData(:,2);
ecgData.leadII=rawData(:,3);
% The augmented vector leads and lead III are derived as
% III=II-I; aVR=-(I+II)/2; aVL=I-II/2; aVF=II-I/2
ecgData.leadIII=ecgData.leadII-ecgData.leadI;
ecgData.aVR=-(ecgData.leadI+ecgData.leadII)/2;
ecgData.aVL=ecgData.leadII/2;
ecgData.aVF=ecgData.leadII-ecgData.leadI/2;
ecgData.V1 = rawData(:,8);
ecgData.V2 = rawData(:,4);
ecgData.V3 = rawData(:,5);
ecgData.V4 = rawData(:,6);
ecgData.V5 = rawData(:,7);
ecgData.V6 = rawData(:,1);

Answers (1)

Taylor
Taylor on 13 Nov 2024 at 15:29
You can use the tiledlayout function.
  1 Comment
Star Strider
Star Strider on 13 Nov 2024 at 18:32
To use the commonly-accepted plot format for a 12-lead EKG —
EKG = rand(12, 30)
EKG = 12×30
0.5645 0.8383 0.9293 0.4759 0.2917 0.8711 0.0790 0.9383 0.3629 0.7670 0.3053 0.3313 0.6932 0.7450 0.9173 0.4848 0.4852 0.7757 0.3993 0.8642 0.9678 0.1893 0.0029 0.4950 0.6808 0.7747 0.7169 0.6671 0.2423 0.3959 0.8346 0.0080 0.8694 0.6672 0.0756 0.1891 0.0386 0.1905 0.3308 0.3633 0.9056 0.5663 0.0607 0.4615 0.8307 0.4357 0.7547 0.2617 0.9895 0.2473 0.7645 0.0714 0.7314 0.4927 0.0580 0.7093 0.0834 0.7614 0.1604 0.2625 0.7353 0.4712 0.6174 0.5418 0.4913 0.1357 0.0045 0.7354 0.9782 0.3538 0.4078 0.0894 0.0471 0.5717 0.3178 0.2072 0.7388 0.4853 0.2316 0.8900 0.7048 0.3913 0.7248 0.8711 0.0827 0.8154 0.4226 0.7317 0.4774 0.9993 0.5804 0.5589 0.2256 0.2275 0.8435 0.2975 0.8315 0.8307 0.2032 0.3711 0.3858 0.4426 0.3072 0.1347 0.6333 0.3395 0.8182 0.5393 0.2128 0.9491 0.7247 0.9907 0.4502 0.7987 0.1446 0.8287 0.4681 0.2318 0.5833 0.2779 0.3054 0.7665 0.3990 0.7260 0.8752 0.9698 0.0291 0.3596 0.0361 0.1887 0.1596 0.0973 0.0348 0.7675 0.6196 0.7757 0.6376 0.2788 0.1162 0.0094 0.2840 0.4705 0.9523 0.3854 0.4726 0.0779 0.2481 0.7228 0.3456 0.1751 0.5994 0.3085 0.9341 0.4567 0.4454 0.4668 0.2510 0.1486 0.6184 0.8891 0.4057 0.3810 0.1174 0.8287 0.7848 0.7574 0.3315 0.0272 0.5625 0.3506 0.2205 0.3259 0.4701 0.6399 0.1888 0.7560 0.3870 0.4428 0.0767 0.9314 0.4941 0.1226 0.9174 0.5963 0.2986 0.2626 0.7647 0.9381 0.8315 0.9004 0.0209 0.0567 0.1619 0.0858 0.0560 0.8939 0.5899 0.8741 0.7095 0.6759 0.5728 0.0349 0.5623 0.1894 0.6255 0.3233 0.5584 0.9196 0.2863 0.7257 0.1768 0.0133 0.1665 0.3105 0.7845 0.0356 0.2371 0.1885 0.8909 0.1795 0.0383 0.4794 0.5287 0.9687 0.3971 0.1250 0.2866 0.2687 0.1672 0.2529 0.0052 0.3402 0.1213 0.5489 0.3356 0.0668 0.7513 0.6273 0.2124 0.9235 0.3989 0.1727 0.3985 0.9819 0.1970 0.0623 0.2177 0.6404 0.6514 0.5170 0.4117 0.4923 0.4770 0.2187 0.2354 0.3681 0.6646 0.3215 0.4120 0.7325 0.9181 0.4085 0.0583 0.6451 0.8610 0.0919 0.2277 0.1116 0.1433 0.1861 0.3687 0.6180 0.9247 0.4730 0.7439 0.0673 0.8539 0.9445 0.0316 0.6098 0.4841 0.9943 0.8368 0.7453 0.1034 0.0296 0.1981 0.6951 0.5283 0.1107 0.3203 0.2422 0.2506 0.3752 0.6030 0.0987 0.2803 0.4782 0.1536 0.1619
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
t = linspace(0, 3, 30);
figure
Leads = ["I" "II" "III" "aV_"+["R" "L" "F"] "V_"+(1:6)];
tiledlayout(3, 4, TileIndexing='columnmajor')
for k = 1:12
nexttile
plot(t, EKG(k,:))
grid
title(Leads(k))
end
.

Sign in to comment.

Categories

Find more on ECG / EKG in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!