4 views

Uploaded by OwenHumphreys

save

- AD039542 a Summary of Underwater Acoustic Data Part II
- NonLinOptCorrel_Yubook
- 760 Series Valves
- Index
- Q Onset and P Onset Detection for Ecg Printerval Measurement
- Vega Inductosyn Digital Converter
- 03_AC_Meters
- Multi-frequency Ultrasonic Auscultation as a Detection and Evaluation Tool for Damage in Cement-based Materials
- Properties of Sound
- 677ti
- 2014 Visikom 04 Grayscale Image Analysis (1)
- High Frequencies & Microwaves - Lab 1
- TM 11-6625-2578-12_Radio_Test_Set_Group_OQ-60_USQ-46_1972
- Dz 2645434546
- 2 2 Properties of Sound
- Chapter Two Mitigation Techniques
- waves webquest
- Understanding the Recording Process and RIAA Equalization
- 19630040
- Chapter 2 AM
- seminar report on contraction mapping in adaptive filters
- Linear Systems and Signals B P Lathi
- Section 1 PDF
- Notes 10 - Intro to FR Assignment
- Tinnitus Today March 1992 Vol 17, No 1
- paper_gt2016-56548_-_support_vibration_diagnostics_and_limits_in_gt_-_16jan2016.pdf
- CS 674 - Digital Image Processing
- Nov Paper 1
- preprint-ccece-sim.pdf
- Zero Oder Reduction Report by Chris Lesesne (19Aug10)
- 2011-03-15 Medición Flechado LT
- DISENO_DE_MEZCLA_PARA_CONCRETO_F_c_210_K.pdf
- CAPÍTULO 3_1
- telurometro certificado
- ODONTIATRIKES-DAPANES-GIANNAKHS
- Inauguración de Evento Singularity en Puerto Vallarta.
- Bolu kemojo khas riau.docx
- Forma y Diseño - Louis Kahn
- Food Truck Business Plan Sample Legal Templates
- 257188080-SOP-PMK-docx.docx
- LIBRO-Ingenieria_Sismica_universidad tecnica de Madrid.pdf
- INFORMACIÓN_PRIMORDIAL_SOBRE_EL_DEPARTAMENTO.pdf
- BANSA.docx
- A.xlsx
- Beristáin, Helena - Análisis e interpretación del poema lírico.pdf
- Proposal+Bible+Camp.doc
- paquetes dj df
- Practical 27 - Flow of Electrical Charge.pdf
- Sección Primera Regla Adu
- Uji Sensitivitas Bakteri
- -Oral-COm wk 1
- Evaluacion Del Aprendizaje MODULO 4
- patologias endosco
- Pablo Alboran Biog
- documents.tips_manualul-sudorului-566f2eb1a6677.pdf
- Panduan Survey
- Cuestionarios Legislación Ambiental
- 2.3 spo triase.docx
- resonadores, tecnica de canto
- 033-2 PRORACUN VIJAKA.pdf

You are on page 1of 14

10382535

**load ecgpvcs.mat
**

y=length(ecg1);

d=[1:y]/200;

ecg1=ecg1/1000;

**%determining number of samples in data%
**

%to convert into time domain%

%convert to volts

%%%%%%%%%%%%%plot

figure(1)

plot(d,ecg1)

xlabel 'seconds'

ylabel 'Volts'

title 'Time domain: original signal'

N = 2048;

X = abs(fft(ecg1,N));

X = fftshift(X);

F = [-N/2:N/2-1]/N*200;

figure(2)

plot(F,X)

xlabel 'frequency'

title 'Frequency domain: original signal'

Figure 1 unfiltered ecg signal in time domain

Owen Humphreys 10382535 Figure 2 closer view of unfiltered ecg signal in time domain Figure 3 unfiltered ecg signal in frequency domain .

Rp=0.den] = iirnotch(wo. Figure 4 filtered ecg signal in time domain .den.ecg1). ecg1=filter(num.Rp. [n.den]=butter(n. Fn=Fs/2. Rs=40. ecg1=filter(num. bw = wo/35.den.bw).Owen Humphreys 10382535 %%%%%%%%%%%%%%%% filter % 50 Hz notch filter wo = 50/(500/2).Wn. % high pass filter Fs=200.Rs).bw).1.ecg1).'high'). % 60 Hz notch filter wo = 60/(500/2). [num. ecg1=filter(num. bw = wo/35. [num.Ws.Wn] = buttord(Wp. Wp=0. Ws=2/Fn.den.1/Fn.ecg1). [num.den] = iirnotch(wo.

Figure 5 closer view of filtered ecg signal in time domainshows a closer view of the signal in the time domain. There is no peak at 50 or 60 Hz so the notch filters have no effect. the low frequency noise due to body movement has been removed and the ECG signal has become straighter. The removal of the DC or very low .Owen Humphreys 10382535 Figure 5 closer view of filtered ecg signal in time domain Figure 6 filtered ecg signal in frequency domain Figure 3 unfiltered ecg signal in frequency domain shows a very large peak at around 0 Hz. After the low pass filter the large peak at around 0 Hz is attenuated.

[Rmag.ecg1(S).4 & ecg1(R)<0.'MinPeakHeight'.'r').'y').'MarkerFaceColor'.ecg1(R_pvc). %smooth signal %find R peaks [~.'rv'.'MarkerFaceColor'. %find S Peaks ecg1_inverted=-ecg1. %invert ecg to find S peak [~. ecg1(S)).R]=findpeaks(ecg1.'rv'.3). %%%%%%%%%%%%%%%% Peak Detection ecg1 = sgolayfilt(ecg1.Owen Humphreys 10382535 frequency signal results in the baseline at 0 V as expected. . plot(R_pvc.65).65).0.'rv'.21). whereas it was at 2 V before filtering.0. %%%%%%%%%plot figure hold on plot(ecg1) xlabel 'seconds' ylabel 'Volts' title 'Time domain: peak detection' plot(R_normal.'MinPeakHeight'. %separate into R peaks into R Normal and R PVC R_normal = R(ecg1(R)>0.'MarkerFaceColor'. R_pvc= R(ecg1(R)>0.ecg1(R_normal).S]=findpeaks(ecg1_inverted.4).7.'g'). Smag] = deal(ecg1(R). plot(S.

The distance between these peaks could then be calculated. PVC R. PVC R peak (orange). this would give more features to classify the PVC beats than the Pan Tompkin. PVC R. and S peaks isolated Figure 8 Closer view of ECG with Normal R. normal S peak (green). and S peaks isolated This method can detect the normal R peak (red).Owen Humphreys 10382535 Figure 7 ECG with Normal R. and PVC S peak (also green. Although the signal needs . they have not been separated).

Figure 9 Output of Pan Tompkin . %%%%%%%%%%Pan Tompkin [qrs_amp_raw.200.Owen Humphreys 10382535 to be much smoother because there are many false detections.1).qrs_i_raw.delay]=pan_tompkin(ecg1. Therefore the Pan Tompkin code is used instead.

Figure 11 Output of Pan Tompkin .Owen Humphreys 10382535 Figure 10 Closer view of Output of Pan Tompkin The Pan Tompkin first applies a low pass filter to remove high frequency noise. This creates just two peaks per beat which makes it easier for peak detection. It then applies a high pass filter to remove low frequencies caused by body movement. It squares the magnitude to reduce low amplitude signals and amplify the large amplitude signals. The signal is then averaged over 30 samples to create a single peak for peak detection.

this is used as the second feature for classification.Owen Humphreys 10382535 Figure 12 Closer view of output of Pan Tompkin The red line is the moving average of the amplitude of the peaks. The Pan Tompkin also calculated the distance between the R peaks. . The Pan Tompkin outputs the amplitude of the R wave. A PVC R peak is identified if it is above this red line. The output points do not need to fit absolutely on the ECG. they just need to be correct relative to each other. It is only the relative heights and distances between the points that is needed to identify PVC beats. Comparing the Pan Tompkin output to the original ECG signal it is clear that the Pan Tompkin output is shifted. and the sample number it occurred at.

%set first value. this won't work in loop %find relative distance between peaks by subtracting absolute values .Owen Humphreys 10382535 Figure 13 Comparing original ECG signal to output of Pan Tompkin (green circles) %%%%%%%%%%%%%%%%%%% feature selection %change from 1 row 401 columns to 401 rows 1 column feature1=rot90(qrs_amp_raw).1)]. feature2=[zeros(401. %initialise vector feature2(1)=26.

c2=find(train_data(:. while k<402 if feature1(k)>0. The class is set by choosing every R peak that is above the value of 0.train_data(c2.3).Owen Humphreys 10382535 k=2. end k=k+1.1)]. while k<402 feature2(k)=qrs_i_raw(k)-qrs_i_raw(k-1).3). end The class is notated by 1 = PVC. %%find best features correlation=abs(corrcoef(train_data)) scatter(train_data(c1. %split into train and test data train_data=data(1:120.55. k=1.1)==-1).1)==1).:).2). -1 = Normal. test_data=data(120:401. then manually checking and changing if any of the values are incorrect. 'r') xlabel 'Samples between R peaks' ylabel 'Magintude of R peaks' title 'Magnitude Vs Distance between R peaks' Class Feature 1 Feature 2 . end %store classes and features data=[class feature1 feature2]. %%split classes c1=find(train_data(:.2).train_data(c1. 'b') hold on scatter(train_data(c2. %%%%%% set class class=[zeros(401. k=k+1. else class(k)=-1.55 class(k)=1.:).

9530 1. k=1.0000 Figure 14 Table of correlation values The correlation function shows a very high correlation between the class and the height of the R peak. count=count+1.0000 0.1)). train_data(:. end k=k+1.train_data(:. There is a very clear separation between the two groups of data on the magnitude y axis.2:3) .2:3) .Owen Humphreys 10382535 1.:)==0. while k<121 if accuracy_train(k. A hyperplane could be drawn between the two sets of data at about 110 samples on the x axis (the distance between the R peaks). but the data is much closer together and the correlation is not as good.0731 1. accuracy_train=train_data(:.1644 0. count=0. Good hyperplane Figure 15 scatter plot showing correlation %%%%%%%%%%% Train_data Accuracy Predicted_Train_lebels = classify (train_data(:.1644 0.9530 0.0731 0. . This can also be seen with a scatter plot of the data.1)-Predicted_Train_lebels.0000 0.

accuracy_test=test_data(:. . while k<283 if accuracy_test(k.train_data(:. count=count+1.2) .2) .1)-Predicted_Test_lebels k=1. accuracy_test=test_data(:. count=count+1.:)==0.3) .train_data(:. train_data(:. end accuracy_Predicted_Test_lebels=count/282 %%%%%%%%%%% Test_data Accuracy Feature2 clc Predicted_Test_lebels = classify (test_data(:. end k=k+1.:)==0.1) ). count=0.1) ).Owen Humphreys 10382535 end accuracy_Predicted_Train_lebels=count/120 %%%%%%%%%%% Test_data Accuracy Feature1 clc Predicted_Test_lebels = classify (test_data(:. while k<283 if accuracy_test(k. train_data(:. count=0.3) .1)-Predicted_Test_lebels k=1.

accuracy_test=test_data(:. train_data(:.1) ). end k=k+1.[2 3]) . count=0. end accuracy_Predicted_Test_lebels=count/282 Feature Train Data Test Data: Feature1 – R Magnitude Test Data: Feature2 – Distance between R peaks Test Data: Feature1 & Feature2 Accuracy 100 % 97. .45 % Conclusion: The most accurate feature to classify the test data is the R peak magnitude alone. end accuracy_Predicted_Test_lebels=count/282 %%%%%%%%%%% Test_data Accuracy Feature1 & Feature2 clc Predicted_Test_lebels = classify (test_data(:.:)==0.Owen Humphreys 10382535 end k=k+1.16 % 68.[2 3]) . count=count+1.train_data(:. while k<283 if accuracy_test(k.1)-Predicted_Test_lebels k=1.79 % 96.

- AD039542 a Summary of Underwater Acoustic Data Part IIUploaded byaivanov3
- NonLinOptCorrel_YubookUploaded byAnonymous FGY7go
- 760 Series ValvesUploaded byStefan Mitu
- IndexUploaded bysandy
- Q Onset and P Onset Detection for Ecg Printerval MeasurementUploaded byIJSTR Research Publication
- Vega Inductosyn Digital ConverterUploaded byAl Zanoaga
- 03_AC_MetersUploaded byKenneth Kuok
- Multi-frequency Ultrasonic Auscultation as a Detection and Evaluation Tool for Damage in Cement-based MaterialsUploaded byAlberto Delgado Quiñones
- Properties of SoundUploaded byAnjhana Kumar
- 677tiUploaded bycheng_cheng1234
- 2014 Visikom 04 Grayscale Image Analysis (1)Uploaded byFajar Ilman Saputra
- High Frequencies & Microwaves - Lab 1Uploaded byTotemika
- TM 11-6625-2578-12_Radio_Test_Set_Group_OQ-60_USQ-46_1972Uploaded byWurzel1946
- Dz 2645434546Uploaded byIJMER
- 2 2 Properties of SoundUploaded bySifatSharmin
- Chapter Two Mitigation TechniquesUploaded byAmare Kassaw
- waves webquestUploaded byapi-399778797
- Understanding the Recording Process and RIAA EqualizationUploaded byabsalomloot
- 19630040Uploaded byshirtquitters
- Chapter 2 AMUploaded byAnis Najihah
- seminar report on contraction mapping in adaptive filtersUploaded bySrinivasSunny
- Linear Systems and Signals B P LathiUploaded byprashantgemini
- Section 1 PDFUploaded byCallum
- Notes 10 - Intro to FR AssignmentUploaded byJai Gaizin
- Tinnitus Today March 1992 Vol 17, No 1Uploaded byAmerican Tinnitus Association
- paper_gt2016-56548_-_support_vibration_diagnostics_and_limits_in_gt_-_16jan2016.pdfUploaded bybigsteve9088
- CS 674 - Digital Image ProcessingUploaded byMuhammadAbdullah59
- Nov Paper 1Uploaded byqidamadani
- preprint-ccece-sim.pdfUploaded byNeelu02
- Zero Oder Reduction Report by Chris Lesesne (19Aug10)Uploaded byThomas A. Searles