QRS complex detection in ventricular tachycardia ECG

6 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Star Strider
Star Strider il 31 Mag 2020
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.
  2 Commenti
Mohamad Aswad Bachtear Effendy
islocalmin is undefined? and why I cannot use this code if this is a homework?
Star Strider
Star Strider il 1 Giu 2020
The islocalmin function was introduced in R2017b. Earlier MATLAB releases will not have it.
In its absence, use findpeaks with a negative argument instead:
[pks,locs,w,prom] = findpeaks(-filtered_EKG, ... name-value pair arguments as appropriate ...);
If you use my code (or code provided by anyone else) to submit as your own work for a homework assignment, that would be cheating (and plagiarism). It would give you an unfair advantage, and you would learn nothing about solving the problem. Also, note that instructors are known to go through MATLAB Answers looking for for posted homework questions.
We provide hints for homework, rarely complete code. We will commonly troubleshoot problems with posted code for homework questions, however it must be obvious that the code is serious attempt at solving the problem.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by