Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PVC Arrhythmia

monay555

Newbie level 4
Joined
Jan 23, 2023
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
33
hey.
I need help to detection P wave and T wave correct in ECG signal i am use Matlab.
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
5,953
Helped
1,172
Reputation
2,356
Reaction score
1,302
Trophy points
1,393
Location
California, USA
Activity points
32,382
I need a lot of things, too.
What kind of help do you need? Do you need a ride to the computer store? Do you need someone to design the hardware for you? Do you need someone to write the Matlab code for you?
 

monay555

Newbie level 4
Joined
Jan 23, 2023
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
33
I have code Matlab, but the P wave and T wave when PVC Arrhythmia is detected are wrong can you help me?

p wave.jpg
 

monay555

Newbie level 4
Joined
Jan 23, 2023
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
33
I am using a window that:
Code:
%P Peak
a=Rloc(i,j)-90:Rloc(i,j)-10;
m=max(y1(a));
b=find(y1(a)==m);
b=b(1);
b=a(b);
Ploc(i,j)= round(b);
Pamp(i,j)=round(m);
%T Peak
a=Rloc(i,j)+25:Rloc(i,j)+90;
m=max(y1(a));
b=find(y1(a)==m);
b=b(1);
b=a(b);
Tloc(i,j)=round(b);
Tamp(i,j)=round(m);
the window is used to search for locations based on the R wave, how can be corrected when PVC beats, by code MatLab?
and thanks for your response.
 
Last edited by a moderator:

Aussie Susan

Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,474
Helped
402
Reputation
804
Reaction score
440
Trophy points
1,363
Activity points
17,322
My Electrical Engineering Masters Thesis was on exactly this - automatic detection of both regular and ectopic ECG beats. I used a 1MHz Z80 and assembler in the late 1970's. Also I was reading the signal from a Holter Monitor at 60 times real speed (so a complete 24 hour measurement was analysed in 24 minutes).
My approach was to detect the peak of the QRS (or ectopic) wave and then correlate the whole waveform against up to 6 templates - one 'normal' and up to 5 ectopics. (I also calculated the R-R interval to get the heart rate etc.) The assumption made was that the first few beats were the 'normal' ones to fill in the first template. If a beat was detected that didn't match any template then it was 'remembered' as a new template beat.
Remember that the ectopic you are looking at comes from the ventricle and so there need not be a P wave (which is the atria contracting) and the T wave (the ventricles depolarising) will not be 'standard' either as the depolarisation will not follow the normal 'bottom to top' path through the ventricles.
I hope you have studied the physiology of the heart as this is (in my opinion) essential knowledge to interpret the ECG waveform.
Susan
 

kaz1

Full Member level 4
Joined
Aug 15, 2019
Messages
195
Helped
14
Reputation
28
Reaction score
31
Trophy points
28
Location
UK
Activity points
1,282
I am using a window that:
%P Peak
a=Rloc(i,j)-90:Rloc(i,j)-10;
m=max(y1(a));
b=find(y1(a)==m);
b=b(1);
b=a(b);
Ploc(i,j)= round(b);
Pamp(i,j)=round(m);
%T Peak
a=Rloc(i,j)+25:Rloc(i,j)+90;
m=max(y1(a));
b=find(y1(a)==m);
b=b(1);
b=a(b);
Tloc(i,j)=round(b);
Tamp(i,j)=round(m);
the window is used to search for locations based on the R wave, how can be corrected when PVC beats, by code MatLab?
and thanks for your response.
do you have a text or binary file for that ECG waveform to be read in matlab?
 

monay555

Newbie level 4
Joined
Jan 23, 2023
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
33
do you have a text or binary file for that ECG waveform to be read in matlab?
I have, but I work on the signal from MIT-BIH Arrhythmia.
What should be doing?
--- Updated ---

My Electrical Engineering Masters Thesis was on exactly this - automatic detection of both regular and ectopic ECG beats. I used a 1MHz Z80 and assembler in the late 1970's. Also I was reading the signal from a Holter Monitor at 60 times real speed (so a complete 24 hour measurement was analysed in 24 minutes).
My approach was to detect the peak of the QRS (or ectopic) wave and then correlate the whole waveform against up to 6 templates - one 'normal' and up to 5 ectopics. (I also calculated the R-R interval to get the heart rate etc.) The assumption made was that the first few beats were the 'normal' ones to fill in the first template. If a beat was detected that didn't match any template then it was 'remembered' as a new template beat.
Remember that the ectopic you are looking at comes from the ventricle and so there need not be a P wave (which is the atria contracting) and the T wave (the ventricles depolarising) will not be 'standard' either as the depolarisation will not follow the normal 'bottom to top' path through the ventricles.
I hope you have studied the physiology of the heart as this is (in my opinion) essential knowledge to interpret the ECG waveform.
Susan
thank you for your response, I am a Master's Student working on the detection of PVC Arrhythmia by machine learning, so is very important to the Feature Extraction step like PR interval, QT interval, RR interval, QRS width, pre_rr, and post_rr interval.
but I have a problem with the p wave and T wave in case PVC.
 

Attachments

  • p wave.png
    p wave.png
    93.6 KB · Views: 12
  • pwave.jpg
    pwave.jpg
    50.4 KB · Views: 11
  • 119m.txt
    88.3 KB · Views: 9
  • p wave.png
    p wave.png
    93.6 KB · Views: 11
  • pwave.jpg
    pwave.jpg
    50.4 KB · Views: 8
Last edited:

kaz1

Full Member level 4
Joined
Aug 15, 2019
Messages
195
Helped
14
Reputation
28
Reaction score
31
Trophy points
28
Location
UK
Activity points
1,282
so is very important to the Feature Extraction step like PR interval, QT interval, RR interval, QRS width, pre_rr, and post_rr interval.
but I have a problem with the p wave and T wave in case PVC.
That is a different task. If you want all such checks by machine then I am afraid it is a big job and as Susan suggested you need to have templates to correlate. If your focus is on PVC only and as per your waveforms then I expect it to be simpler and then you don't expect to care about P or T waves.
 

monay555

Newbie level 4
Joined
Jan 23, 2023
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
33
But how can create the templates for normal and PVC to Apply in Matlab? To make ECG Wave (P, QRS, and T ) correct in the signal.
--- Updated ---

That is a different task. If you want all such checks by machine then I am afraid it is a big job and as Susan suggested you need to have templates to correlate. If your focus is on PVC only and as per your waveforms then I expect it to be simpler and then you don't expect to care about P or T waves.
the target is based on feature extraction.

tagert.png
 
Last edited:

kaz1

Full Member level 4
Joined
Aug 15, 2019
Messages
195
Helped
14
Reputation
28
Reaction score
31
Trophy points
28
Location
UK
Activity points
1,282
But how can create the templates for normal and PVC to Apply in Matlab? To make ECG Wave (P, QRS, and T ) correct in the signal.
--- Updated ---


the target is based on feature extraction.
I don't have specific experience with ECG or feature extraction tools but have done image correlation for tracking. But below are my thoughts.

You don't create ECG templates but you get them from whatever sources as references. Once you have templates you can then apply correlation e.g. matlab xcorr.

In principle if you have two signals x1, x2 and you want to see how similar or different they are you apply y=xcorr(x1,x2); The amplitude of y is a measure of similarity.
You can apply autocorrelation i.e. y = xcorr(x1,x1). you get one clear peak (100% similarity...).

I guess you can zero any section of x1 then xcorr with original x1 to study the effect of removing specific wave section. Thus you will need experimenting with various sections of the waveform to make your conclusions.

Having said that you may have more advanced tools for feature extraction...
 
Last edited:

monay555

Newbie level 4
Joined
Jan 23, 2023
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
33
Of course you would. Re-read the last 2 paragraphs of my posting above, especially the 2nd to last.
Susan
Good evening.
I want your opinion on this article and thanks.
mona
 

Attachments

  • Advanced_P_Wave_Detection_in_Ecg_Signals_During_Pa.pdf
    1.6 MB · Views: 8

Aussie Susan

Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,474
Helped
402
Reputation
804
Reaction score
440
Trophy points
1,363
Activity points
17,322
(Before I start, I mis-typed in my first response above: instead of 'depolarisation' I meant 'repolarisation'.)
I may have misunderstood your problem but some basic physiology should show you why you are having trouble with identifying the P wave in ventricular ectopics.
A sinus beat starts when the SA node begins a coordinated wave of contraction through the atria. This is the P wave.
The 'beat' then passes through the AV node, the Bundle of His and then the Purkinji fibres into the bottom part of the ventricles where the cardiac muscle then have a coordinated contraction back up towards the fat layer that separate the atria and ventricles. This is the QRS wave.
Given the physiology of nerve cells and muscle cells, once they are triggered (depolarised), they enter a refractory period (where they cannot be triggered again, which stops the contraction doubling back on itself) while they are repolarised. This is the T wave.
If an ectopic beat originates in the ventricles, then (except in very unusual circumstances) there will not be a P wave (and those unusual circumstances typically mask any P wave that might be generated from the ectopic).
So looking for a P wave in an ectopic beat is really a waste of time.
Also, the T wave can often be mis-shapen (as opposed to its shape for a sinus beat).
What I did was to look for the biggest peak (positive or negative as ectopics can produce inverted QRS complexes) and then look back and forward a number of samples (I was working with 100 samples/second of the waveform) and 'assumed' that covered the whole wave. That was what I stored in memory (remember I was using assembler - we only had very basic compilers then and nothing like MatLab) as a template if I couldn't match a previously seen beat.
This was my way of 'machine learning'. It didn't matter what the actual beat waveform looked like (it didn't need to conform to a pre-defined shape) as this changes with each patient, the lead configuration and placement and other physiological conditions.
The context for my work was to provide a cardiologist with a summary of the specific ectopics that a patient had (plus the R-R interval.heart rate) in the 24 hour ambulatory monitoring period. Therefore the analysis of the ectopics was done by a trained human so I didn't need to get into minute details about 's-t' intervals etc..
While (micro)computers are 1000x (or more) faster these days, I still would question why you need in-depth real-time analysis of each beat. You can (almost) ignore the sinus beats and concentrate on the ectopics which generally repeat (i.e. they have roughly the same shape for a particular patient) even if there are several ectopic foci. Once you have the representative beats then you can analyse the heck out of them.
Susan
--- Updated ---

By the way, I just started to read the paper you referenced and saw on page 5:

Detection of premature ventricular contraction. Detection of premature ventricular contraction is a very important step for demarcating an area where P waves can occur. The detection comprises two steps, feature extraction and heartbeat classification. The results of classification are used to decide whether the P wave should be searched for. The P wave is not searched for if the actual QRS complex is classified as PVC, because the P wave is not present.

Susan
 

monay555

Newbie level 4
Joined
Jan 23, 2023
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
33
Good morning
thank you very much for the good explanation of this topic.
(Before I start, I mis-typed in my first response above: instead of 'depolarisation' I meant 'repolarisation'.)
I may have misunderstood your problem but some basic physiology should show you why you are having trouble with identifying the P wave in ventricular ectopics.
A sinus beat starts when the SA node begins a coordinated wave of contraction through the atria. This is the P wave.
The 'beat' then passes through the AV node, the Bundle of His and then the Purkinji fibres into the bottom part of the ventricles where the cardiac muscle then have a coordinated contraction back up towards the fat layer that separate the atria and ventricles. This is the QRS wave.
Given the physiology of nerve cells and muscle cells, once they are triggered (depolarised), they enter a refractory period (where they cannot be triggered again, which stops the contraction doubling back on itself) while they are repolarised. This is the T wave.
If an ectopic beat originates in the ventricles, then (except in very unusual circumstances) there will not be a P wave (and those unusual circumstances typically mask any P wave that might be generated from the ectopic).
So looking for a P wave in an ectopic beat is really a waste of time.
Also, the T wave can often be mis-shapen (as opposed to its shape for a sinus beat).
What I did was to look for the biggest peak (positive or negative as ectopics can produce inverted QRS complexes) and then look back and forward a number of samples (I was working with 100 samples/second of the waveform) and 'assumed' that covered the whole wave. That was what I stored in memory (remember I was using assembler - we only had very basic compilers then and nothing like MatLab) as a template if I couldn't match a previously seen beat.
This was my way of 'machine learning'. It didn't matter what the actual beat waveform looked like (it didn't need to conform to a pre-defined shape) as this changes with each patient, the lead configuration and placement and other physiological conditions.
The context for my work was to provide a cardiologist with a summary of the specific ectopics that a patient had (plus the R-R interval.heart rate) in the 24 hour ambulatory monitoring period. Therefore the analysis of the ectopics was done by a trained human so I didn't need to get into minute details about 's-t' intervals etc..
While (micro)computers are 1000x (or more) faster these days, I still would question why you need in-depth real-time analysis of each beat. You can (almost) ignore the sinus beats and concentrate on the ectopics which generally repeat (i.e. they have roughly the same shape for a particular patient) even if there are several ectopic foci. Once you have the representative beats then you can analyse the heck out of them.
Susan
--- Updated ---

By the way, I just started to read the paper you referenced and saw on page 5:

Detection of premature ventricular contraction. Detection of premature ventricular contraction is a very important step for demarcating an area where P waves can occur. The detection comprises two steps, feature extraction and heartbeat classification. The results of classification are used to decide whether the P wave should be searched for. The P wave is not searched for if the actual QRS complex is classified as PVC, because the P wave is not present.

Susan
 

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top