MATLAB: QRS complex detection in ventricular tachycardia ECG

ecgqrs complexqrs complex detection

how do I find out the qrs complex for this ECG? The ECG data taken from physionet. I've been searching the code for quite some time. Help me out please. Thank you!

Best Answer

If this is a homework problem, you will not be able to use this code. If it is for research, you can likely adapt it to other problems.
The Code —
D = load('cu01m.mat');
EKG = D.val;
figure
plot(EKG)
grid
xlim([0 1000])
Fs = 250; % Estimate Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Ts = 1/Fs; % Estimate Sampling Interval
t = linspace(0, numel(EKG), numel(EKG))/Fs;
Wp = [2 90]/Fn; % Normalised Passband (Passband = 46 Hz To 54 Hz)
Ws = [1 100]/Fn; % Normalised Stopband (Passband = 49 Hz To 51 Hz)
Rp = 1; % Passband Ripple/Attenuation
Rs = 50; % Stopband Ripple/Attenuation
[n,Wp] = ellipord(Wp, Ws, Rp, Rs); % Calculate Elliptic Filter Optimum Order
[z,p,k] = ellip(n, Rp, Rs, Wp,'bandpass'); % Elliptic Filter
[sos,g] = zp2sos(z,p,k); % Convert To Second-Order-Sections For Stability
figure
freqz(sos,2^16,Fs)
filtered_EKG = filtfilt(sos,g,EKG);
[lmn,npr] = islocalmin(filtered_EKG, 'MinProminence',100); % Detect: Q & S
lnix = find(lmn);
prqs = npr(lnix);
[lmx,xpr] = islocalmax(filtered_EKG, 'MinProminence',500); % Detect: R
lxix = find(lmx);
prr = xpr(lxix);
figure
plot(t, EKG)
grid
xlim([0 5])
figure
plot(t, filtered_EKG)
grid
xlim([0 5])
figure
plot(t, filtered_EKG)
hold on
plot(t(lxix), filtered_EKG(lxix), 'r^')
plot(t(lnix), filtered_EKG(lnix), 'gv')
hold off
grid
xlim([0 5])
figure
plot(t, EKG)
hold on
plot(t(lxix), EKG(lxix), 'r^')
plot(t(lnix), EKG(lnix), 'gv')
hold off
grid
legend('EKG', 'R', 'Q S')
xlim([0 5])
Use the correct time vector, and make the appropriate changes to the filter design if necesary.