Title: peeasa at sat
1?pe?e??as?a ß???at????? s?µat??
2??at?
- ?ata???s? ?d??t?t?? s?µat??
- ???es? ?a?a?t???st????
- ???te??p???s?
- ?a????µ?s?
3?a?a?t???st???
- ?d??t?te? st? ped?? t?? ??????
- ?d??t?te? st? ped?? t?? s????t?t??
- ?????-fasµat???? ?d??t?te?
- ??p
4?????? p??et??µas?a - Preprocessing
- ??????s?
- BASELINE
- TREND
- ?p?????ß?p???s?
- Gaussian noise
- 50 Hz line interference
- Other specific interferences
5Preprocessing
- ?fa??es? t?? bias - µ?s?? t?µ?
- Trend removal
- ?fa??es? ??aµµ??
- ??de??µ????, afa??es? p??? ?aµ???? fasµat????
s???st?s?? - ?a??????p???s? s?µata ?d?a? e????e?a?
6pa??de??µa
- load fantasia.txt ascii
- test_ecgfantasia(11000,3)
- mnmean(test_ecg)
- y test_ecg -mn
- plot(test_ecg)
- hold on
- plot(y, r)
- y1 detrend(y)
- plot(y)
- hold on
- plot(y1, r)
- http//lomiweb.med.auth.gr/xml_output/sigproc/
7Filters in matlab
- FIR
- b fir1(48,0.35 0.65)
- f 0 0.3 0.4 0.6 0.7 1 a 0 0 1 1 0 0 b
remez(17,f,a) - IIR
- Butterworth n 5 Wn 100 200/500 b,a
butter(n,Wn) - Chebyshev n 10 Rp 0.5 Wn 100 200/500
b,a cheby1(n,Rp,Wn) - Elliptic For data sampled at 1000 Hz, design a
sixth-order lowpass elliptic filter with a cutoff
frequency of 300 Hz, 3 dB of ripple in the
passband, and 50 dB of attenuation in the
stopband - b,a ellip(6,3,50,300/500)
- http//users.ece.gatech.edu/bonnie/book/TUTORIAL/
tut_4.html - http//www.dsptutor.freeuk.com/digfilt.pdf
8Filters in matlab
- The frequency response of all the classic
electronic filters. The first one is the
Butterworth filter, that is the smoothest one but
it has no ripples. The last one is the Elliptic
filter it is the sharpest one but it shows
ripples in both the pass-band and the stop-band.
The two Chebyshev filter in the middle have an
average behavior, being quite sharp with ripples
in part of the spectrum. All the plots have been
obtained using the same parameters and the same
number of coefficients, thus showing only the
properties of the different filters. - http//en.wikipedia.org/wiki/ImageElectronic_line
ar_filters.svg
9?a??de??µa
- load fantasia.txt ascii
- test_ecgfantasia(13000,3)
- b,a butter(9,3/125 50/125)
- y1 filtfilt(b,a,y)
- plot(test_ecg)
- plot(y1)
?????? epe?e??as?a ??a ?a????sµa t??
s?µat??. ???? ?fa????µe t?? p??? ?aµ????
s????t?te? trend ?fa????µe t?? ????? s????t?te?
- ????ß??
10pa??de??µa
- ?????? ????ß??
- Download the ECG signal from the web
http//www.oersted.dtu.dk/ftp/jaj/31610/data/data4
/ecg.mat - Sampling frequency 500 Hz. Values in volts.
Amplification factor on the electrode signals
500. - load ecg.mat
- plot(ecg)
11pa??de??µa
- ?a??? t? ?p??e?µe?? ??????ta? e?af??,
?ata???feta? ??a ?aµ???? s????t?ta? µ???? s?µa
p?? ep????eta? st? ECG ?a? ?a??st? p?? d?s????
t? µe??t? t??. - ?? s?µa p?? ape?????saµe e??a? ??a t?t???
pa??de??µa. G?a ?a ap?µa???????? ?? µ?????
s???st?se? - set frequencies below 0.5 Hz to zero
- b,a butter(7,0.6/250 200/250)
- Y FILTFILT(b, a, ecg)
12pa??de??µa
- ?a?at????µe t?? d?af???? t?? a?????? ?a? te?????
s?µat??. - plot(Y,'r')hold onplot(ecg)
13Increasing the signal-to-noise ratio
- The ECG signal is also contaminated with noise.
The amount of noise is proportional to the
measurement bandwidth. - A higher bandwidth will give more noise in the
signals, and limiting the bandwidth can obscure
details in the ECG. - Try to find a compromise on the cut-off
frequency, where the shape of the ECG signal is
preserved and the noise reduced. Try different
choices and plot and comment on the results. - Make a plot of one period of the new filtered
signal ecg3 and identify as many intervals in the
ECG as you can.
14Increasing the signal-to-noise ratio
- b,a butter(3,0.6/250 10/250)
- Y1 FILTFILT(b, a, Y)
- figure
- plot(Y1(11000),'r')hold onplot(Y(11000))title
('10Hz') - b,a butter(3,0.6/250 20/250)
- Y1 FILTFILT(b, a, Y)
- figure
- plot(Y1(11000),'r')hold onplot(Y(11000))title
('20Hz') - b,a butter(3,0.6/250 50/250)
- Y1 FILTFILT(b, a, Y)
- figure
- plot(Y1(11000),'r')hold onplot(Y(11000))title
('50Hz') - b,a butter(3,0.6/250 100/250)
- Y1 FILTFILT(b, a, Y)
- figure
- plot(Y1(11000),'r')hold onplot(Y(11000))title
('100Hz') -
15(No Transcript)
16Removing 50 Hz interference
- Often the ECG is contaminated with 50 Hz noise
from the power outlet, which overlaps the ECG.
This interference should be removed. - Szsize(Y,1)
- for i1Sz, Y50(i,1)Y(i,1)0.1cos(2pii50/500)
end - plot(Y50(11000))
- Design a filter for removing 50 Hz noise as a
Notch filter with a zero at 50 Hz. A Notch filter
is an all-pass filter with a zero at one given
frequency. - Apply the filter to the signal and generate a new
signal ecg2. Plot the new signal and note the
difference. - n 5
- Wn 1 45/500
- b,a butter(n,Wn)
- Y1 FILTFILT(b, a, Y)
- n 5
- Wn 55 150/500
- b,a butter(n,Wn)
- Y2 Y1FILTFILT(b, a, Y1)
- hold on
17ped?? t?? ?????? Crosscorrelation-S?s??t?s?
- ? s?s??t?s? d?? s??a?t?se?? x(t) ?a? y(t)
????eta? se s??s? µe t? ??????? ?a??st???s? t - ???s?µ?p??e?ta? ??a ?a µet??se? t? ßa?µ? st??
?p??? s?s?et????ta?- µ??????? ta d?? s?µata.
18Cross-correlation
- ? s?s??t?s? ?a??????p??e?ta? st?? pe????? ap? -1
(complete anti-synchronization) ??? 1 (complete
synchronization). ??µ? s?s??t?s?? ???t? st? µ?d??
de???e? ??aµµ??? a?e?a?t?s?a t?? d?? s?st?µ?t??. - ?p?te?e? ??a ap? ta ap???ste?a ?a? p??
s?????sµ??a µ?t?a t?? s???????sµ?? d??
s?st?µ?t??, a? ?a? de? e??a? e?a?s??t? se
µ?-??aµµ??? e???t?s?.
19crosscorrelation
- St?? efa?µ???? s?????? ????µe ??a? pepe?asµ???
a???µ? µet??se??. - ?st? x0 xN-1 ?a? y0 yN-1 d??
?????se???? p?? ?ata???f??a? ta?t?????a, µe
µ?de???? µ?s? t?µ? ?a? µ??ad?a?a variance. ?
s?s??t?s? µp??e? ?a ???ste? sa s????t?s? t?? t
-(N - 1) 0 N - 1
20S?s??t?s? ?? e??a?e?? ??a t? st????s? s?µ?t??
- ??? pa?µ?? ?a? ? s?s??t?s? t???. ?? s?µe??
µ???st?? s?s??t?s?? µp??e? ?a ???s?µ?p????e? ??a
?a st???????? ?? d?? pa?µ??.
Superimposition of the previous traces properly
aligned
21S?s??t?s? ??a t?? e??es? transients
- the upper trace represents the original trace,
- the middle trace the signal masked with noise
- the lower trace the correlation between the
transient and the signal contaminated with noise
22??t?s?s??t?s? -Autocorrelation
- ? s?s??t?s? µ?a? s????t?s?? µe t?? ea?t? t??
???µ??eta? a?t?s?s??t?s?. - ???a? ??a? t??p?? ??a ?a a????e??e? pe???d???t?ta
se ??a s?µa.
23??t?s?s??t?s? ?e???? ????ß??
- ? ?e???? ??a??s?a??? ????ß?? ??e? µ?de????
a?t?s?s??t?s?
nnrandn(1000,1) plot(nn) crxcorr(nn,nn,1000,c
oeff) plot(cr)
24- The autocovariance function will be written as
25pa??de??µa
- load fantasia.txt ascii
- test_ecgfantasia(13000,3)
- b,a butter(9,3/125 50/125)
- y1 filtfilt(b,a,test_ecg)
- crxcorr(y1,y1, 1000,'coeff')
- plot(cr)
- mx,psmax(cr)
- mx 1.0000
- ps 1001
- for i12001
- if( cr(i) lt 0.2) cr(i)0
- end end
- plot(cr)
??s?? fa??eta? ?a e??a? ? ?a?d?a??? ???µ?? 250
samples -gt 1 sec - gt 60 beats/min
26- ??? s?s?et????ta? t? ?a?d?????f?µa µe t??
a?ap?e?st??? ???µ? (st? a??e?? fantasia ) - load fantasia.txt ascii
- test_ecgfantasia(,3)
- b,a butter(3,0.01/125 30/125)
- y1 filtfilt(b,a,test_ecg)
- test_ecgy1
- test_respfantasia(,2)
- b,a butter(3,0.01/125 30/125)
- y1 filtfilt(b,a,test_resp)
- test_respy1
- crxcorr(test_ecg, test_resp, 9000,'coeff')
- plot(cr)
- mx,psmax(cr)
? s?s??t?s? de? p????pte? ap? t?? ap?? ?µ???t?ta
t?? µ??f??
27cross-spectrum function
- St? ped?? t?? s????t?t?? ????eta? t?
cross-spectrum, µ?a µ??ad??? s????t?s?, - ?p?? s??????.
- ? s??s? a?t? a?t?st???e? st? s?s??t?s?.
- ? a?t?s?s??t?s? a?t?st???e? st? autospectrum.
28coherence
- ?? ?a??????p???µ??? cross-spectrum, ???µ??eta?
coherence function. - ???a? t? cross-spectrum ?a??????p???µ??? µe ta
autospectra ???e s????t?s??
where ltgt denotes the ensemble average.
29coherence
- The estimation of the coherence function is not
easy. The ensemble averaging is not possible and
we have to replace it by the time average
assuming the stationarity of underlying dynamics. - Usually one divides time series into segments
and estimates the cross-spectrum and the
autospectra for each segment, and then takes the
average over these segments. The choice of the
segment length, a window function (e.g.,
Bartlett, Welch) is not always obvious and
depends on the problem in hand. - While the coherence function is a function of the
frequency , it is a very useful measure when one
is interested in the synchronization related to
certain frequency ranges only, e.g., in the
classical EEG frequency bands.
30?fa?µ???
- St? p??????µe??pa??de??µa ??? s?s?et????ta? t?
?a?d?????f?µa µe t?? a?ap?e?st??? ???µ? (st?
a??e?? fantasia ) - Cxy,Fcohere(test_resp, test_ecg, 256,250)
31?fa?µ???
- Coherence between 2 eeg channels. Se d?? pe??????
t?? e??ef????, eµfa?????ta? ?? ?d?e? s????t?te? - ???s? t??
- ???e??? C3, C4
- S????t?s?? cohere
32- load A1_C3.txt
- load A1_C4.txt
- c3detrend(A1_C3)
- c4detrend(A1_C4)
- b,a butter(7,3/125 17/125)
- y2 filtfilt(b,a,c4)
- y1 filtfilt(b,a,c3)
- Cxycohere(y1, y2, 256, 128)
- plot(Cxy)
33Power Spectrum Analysis
- ?? power spectrum de???e? t?? ?s?? ???e
fasµat???? s???st?sa? t?? ??µat?µ??f??. - ?? power spectrum ???s?µ?p??e?ta? s???? ??a t??
a????s? f?s????????? s?µ?t??, ?p?? ECG (rate) ?a?
EEG .
34Power Spectrum Analysis
- ?? power spectrum (PS) ????eta? ?? t? tet??????
t?? µ?t??? t?? f?sµat?? -
35?fa?µ???
- Analysis of variations in the instantaneous heart
rate time series using the beat-to-beat
RR-intervals (the RR tachogram) is known as Heart
Rate Variability (HRV) analysis. - HRV analysis has been shown to provide an
assessment of cardiovascular disease. The heart
rate may be increased by slow acting sympathetic
activity or decreased by fast acting
parasympathetic (vagal) activity. - The balance between the effects of the
sympathetic and parasympathetic systems, the two
opposite acting branches of the autonomic nervous
system, is referred to as the sympathovagal
balance and is believed to be reflected in the
beat-to-beat changes of the cardiac cycle.
36?fa?µ???
- The heart rate is given by the reciprocal of the
RR-interval in units of beats per minute. - Spectral analysis of the RR tachogram is
typically used to estimate the effect of the
sympathetic and parasympathetic modulation of the
RR-intervals. - The two main frequency bands of interest are
referred to as the Low-Frequency (LF) band (0.04
to 0.15 Hz) and the High-Frequency (HF) band
(0.15 to 0.4 Hz) . - Sympathetic tone is believed to influence the LF
component whereas both sympathetic and
parasympathetic activity have an effect on the HF
component. - The ratio of the power contained in the LF and HF
components has been used as a measure of the
sympathovagal balance .
37?fa?µ???
- Respiratory Sinus Arrhythmia (RSA) is the name
given to the oscillation in the RR tachogram due
to parasympathetic activity which is synchronous
with the respiratory cycle. The RSA oscillation
manifests itself as a peak in the HF band of the
spectrum. - For example, 15 breaths per minute corresponds to
a 4 second oscillation with a peak in the power
spectrum at 0.25 Hz. - A second peak is often found in the LF band of
the spectrum at approximately 0.1 Hz. - While the cause of this 10 second rhythm is
strongly debated, one possible explanation is
that it may be due to baroreflex regulation which
creates the so-called Mayer waves in the blood
pressure signal .
38Finding the heart rate using autocorrelation
- The heart rate can be found from the
autocorrelation function of the signal. This is
done be finding the first local maximum after the
global maximum at tau 0 in the autocorrelation
function. Make a procedure for doing this
automatically and use it on ECG signal ecg. Limit
your search interval for the maximum to the
possible range for the heart rate. Does your
program find the right pulse rate? Document your
program with plots of the autocorrelation
functions found. - crxcorr(Y2,1200,'coeff')
- plot(cr)
39Periodogram - about HRV analysis
- load thr01.txt
- Pxx, wperiodogram(thr01)
- plot(w,Pxx)
- plot(w(120),Pxx(120))
40?s??s? 1
- 1. This collection consists of 10 heart beat time
series 5 young subjects (Y1.txt, Y2.txt, etc)
and 5 elderly subjects (O1.txt, O2.txt, etc) from
the Fantasia Database. - http//www.physionet.org/physiobank/database/fanta
sia/subset/ - ?a ???e? a????s? t?? µetaß??t?t?ta? t?? ?a?d?a???
???µ?? (stat?st??? ?a? µe ß?s? t? power spectrum)
?a? ?a d?ap?st??e? e?? ?p?????? d?af???p???se??
a??µesa st?? d?? ?µ?de?
41?s??s? 2
- G?a ta EEGs p?? d?a??tete,
- ????sete t?? µp??te? a ?a? ß,
- ß?e?te se µ???? tµ?µata t?? 2 sec p??
µetaß???eta? ? ?s??? se ???e µp??ta, ?a? ?at?
p?s? ?? s????t?te? s???p?????? ta?t?????a sta d??
?a????a