How can I Identify the P,Q,R,S and T waves in all 12 leads of ECG

19 views (last 30 days)
Hi all,
I am currenly working on diagnosing heart diseases using 12 lead ecgs.
for this project i use preprocessed data which has 500hz sampling rate.
Here i attached a sample file from the database i used.
as a first step seperated the 12 leads ecg
Data = load('HR00001.mat'); % 12x5000 double
ecg = Data.val(1,1:5000); % 1x5000 double
my next step is to identify the P,Q,R,S and T waves. As a beginner i found it quite challenging.
I wrote a code which only able to find R waves in the lead I but its totally useless when it comes to other leads.
Can some one help me a step by guidance for detect P,Q,R,S and T in different leads.
Data = load('HR00001.mat'); % 12x5000 double
ecg = Data.val(1,1:5000); % 1x5000 double
peaks_1 = ecg>500;
f_s = 500;
time = (1:numel(ecg))/f_s;
[peaks_2,pos_peaks] = findpeaks(ecg,'MINPEAKDISTANCE',10,'MINPEAKHEIGHT',500);
plot(time,ecg,'b',pos_peaks/500,(peaks_2),'ro')
axis ([0 10 -300 800])
Please help me in this issue . your help will will highly appreciated.
thanks and best regards.
  6 Comments
Star Strider
Star Strider on 17 Oct 2020
Naveen —
My pleasure!
I have a hardcopy of the latest edition in my physical library. If you are doing anything related to heart disease, I suggest that you get a copy or refer to one in your university library It is an invaluable resource.
Naveen F
Naveen F on 17 Oct 2020
Thank you very much for the suggestion Star Strider sir, I will deffinitely send an email to our uni librarian regarding this resource.
Thanks and best regards.

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 17 Oct 2020
Edited: Cris LaPierre on 17 Oct 2020
If you would like an interactive way to try to detect peaks, I suggest using the Find Local Extrema task in the live editor. It allows you to use a graphical interface to set the peak detection parameters. Once you get something you like, you can convrt the task to code, which allows you to build a script to run on multiple data sets.
It might be important to set your expectations here. This is not a silver bullet. You will still need to gain an understanding of what it is doing to use it appropriately, especially if you are trying to make medical diagnoses from your analysis.
  1 Comment
Naveen F
Naveen F on 17 Oct 2020
Thank you very much pitching your answer for my question. I know nothing comes on a silver palate. I'll put my fullest effort on this and find a way to solve my problem using this method. I hope this method will help me to solve my issue.
keep up the good work.
Note : Still i can ask any follow up questions regarding this problem right even after i accept this answer ? (just ask because i am new to this forum )
Thanks and best regards.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!