MATLAB: How to find QRS complex for this Graph

ecgMATLABmatlab 2015bqrs complex

This is the one lead of the 12_lead ECG graph.I split is into the 12 part. Now i wanted to find QRS point in the poin. I also attached the xlsx file. Please Help out.

Best Answer

This is not a trivial problem. This EKG displays the Wolf-Parkinson-White syndrome, so the normal Q-wave is not present. It actually sent me back to Braunwald’s Heart Disease (10th Ed.), P. 665ff since I’ve not seen WPW in a while, to determine what the Q-wave is considered to be in WPW. The best you can hope for in defining the QRS complex is:
D = readmatrix('2nd.xlsx');
t = D(:,1);
EKG = D(:,2);
[lm,pr] = islocalmin(EKG, 'MinProminence',2);
lmix = find(lm);
prr = pr(lmix);
[R,rix] = max(EKG);
figure
plot(t, EKG)
hold on
plot(t(rix), EKG(rix), 'r^')
plot(t(lmix), EKG(lmix), 'gv')
hold off
grid
ylim(ylim*1.25)
text(t(lmix(1)), EKG(lmix(1)), sprintf('\\uparrow\nQ (%.2f ms)', t(lmix(1))), 'VerticalAlignment','top', 'HorizontalAlignment','center')
text(t(rix), EKG(rix), sprintf('R (%.2f ms)\n\\downarrow', t(rix)), 'VerticalAlignment','bottom', 'HorizontalAlignment','center')
text(t(lmix(2)), EKG(lmix(2)), sprintf('\\uparrow\nS (%.2f ms)', t(lmix(2))), 'VerticalAlignment','top', 'HorizontalAlignment','center')
producing:
Note that in WPW, the QRS complex is characteristically wide. It is very difficult to determine the correct QRS complex width here because there appears to be a wandaring baseline, and the QRS complex is generally considered to start when the Q-wave descends from the isoelectric reference in the P-R interval, and ends after the S-wave returns to the isoelectric reference between the S-wave and T-wave. None of those are actually present here, so some compromises are in order.
This code is likely not robust to all such complexes becauses the 'MinProminence' value may change. It works here.