# how do i find the P-R and Q-T interval and QRS duration from a ECG data?

15 views (last 30 days)
karsten chan on 22 Oct 2021
Edited: karsten chan on 24 Oct 2021
hi, i want to get the interval of P-R and Q-T and the QRS duration from a data set tahts a ECG but also a graph that can display the ecg with the the peak, P wave and T wave with the P R Q T S being labelled. what i have currently is below
clc;
clear all;
close all;
ecg=Orig_Sig;
samplingrate=360;
fresult=fft(ecg);
fresult(1 : round(length(fresult)*6/samplingrate))=0;
fresult(end - round(length(fresult)*6/samplingrate) : end)=0;
corrected=real(ifft(fresult));
c_ecg=corrected;
EKG=c_ecg;
Fs=360;
t=[0:size(EKG)-1/Fs];
[R2,TR] = findpeaks( EKG, t, 'MinPeakHeight', 50);
[QS,TQS] = findpeaks(-EKG, t, 'MinPeakHeight', 75);
plot(t, EKG)
hold on
plot(TR, R2, '^r')
plot(TQS(1:2:end), -QS(1:2:end), 'vg')
plot(TQS(2:2:end), -QS(2:2:end), 'vb')
hold off
grid
axis([0 2 ylim])
legend('EKG', 'R', 'Q', 'S')
this is what i hgave so far, its only creating a grpah that isnt working but the ecg data should be processed into a relatively smooth line.
i ahve also attached the ecg data below.

### Community Treasure Hunt

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

Start Hunting!

Translated by