Lucas Parra, CCNY City College of New York BME I5100: Biomedical Signal Processing Linear systems, Fourier and z-Transform Lucas C. Parra Biomedical Engineering Department City College of New York CCNY 1 Lucas Parra, CCNY City College of New York Schedule Week 1: Introduction Linear, stationary, normal - the stuff biology is not made of. Week 1-4: Linear systems (mostly discrete time) Impulse response Moving Average and Auto Regressive filters Convolution Discrete Fourier transform and z-transform Week 5-7: Random variables and stochastic processes Random variables Multivariate distributions Statistical independence Week 8: Electrophysiology Origin and interpretation of Biopotentials Week 9-14: Examples of biomedical signal processing Probabilistic estimation Linear discriminants - detection of motor activity from MEG Harmonic analysis - estimation of hart rate in Speech Auto-regressive model - estimation of the spectrum of 'thoughts' in EEG Independent components analysis - analysis of MEG signals 2 Lucas Parra, CCNY City College of New York z-Transform The z-transform is a map of a discrete signal x[n] into complex valued function X(z) with complex valued z ∞ X (z)= ∑ x[n] z−n n=−∞ For a finite sequence the z-transform is defined for all z. For infinite sequence it is only defined for values of z for which the sum converges. z-transform is important because of the Convolution Theorem: h[n]∗x[n]⇔ H (z) X (z) 3 Lucas Parra, CCNY City College of New York z-Transform - Convolution theorem h[n]∗x[n]⇔ H (z) X (z) Because the z-transform of the convolution ... ∞ ∑ h[n]∗x[n] z−n= n=−∞ ∞ ∞ = ∑ ∑ h[k ] x[n−k ] z−n n=−∞ k =−∞ ∞ ∞ = ∑ ∑ h[k ] x[n' ] z−n' −k n'=−∞ k =−∞ ∞ ∞ = ∑ h[k ] z−k ∑ x[ n' ] z−n' k =−∞ n' =−∞ =H (z) X ( z) 4 Lucas Parra, CCNY City College of New York Z-Transform - Difference model We approximated the response of an IIR system by the difference model P Q y[n]=−∑ a[ k] y[n−k ]+ ∑ b[ k] x[ n−k] k=1 k=0 The z-transform relates the impulse response h[k] to a[k] and b[k]. Define a[0]=1, then we can rewrite: P Q ∑ a [k ] y[n−k]=∑ b[k ] x[n−k ] k =0 k =0 After z-transform on both sides we have A( z)Y (z)=B (z) X ( z) 5 Lucas Parra, CCNY City College of New York z-Transform -rational impulse response With the z-transform of y[n]=h[n]*x[n] : Y (z)=H ( z) X (z) We obtain B( z) X (z)= A(z)Y ( z)=A( z) H (z) X ( z) B (z) H (z)= A(z) Impulse response is called rational if it can be expressed exactly as: Q b[k ] z−k B (z) ∑ H (z)= = k =0 A(z) P 1+ ∑ a[k] z−k k =1 With a sufficient number of terms any H(z) can be approximated by a rational polynomial. 6 Lucas Parra, CCNY City College of New York z-Transform - Difference model and inverse The z-transform of an ARMA filter and its inverse are B( z) A(z) Y (z)= X ( z) X (z)= Y ( z) A( z) B( z) The AR part be omes the MA and the MA be omes AR: H-1(z)b$%& y$n& b$%&x$n& a$k& b$k& "ince in general b$%&1 we have to write! Q P b[0] x[t ]=−∑ b[ k] x [n−k]+ ∑ a[k ] y[n−k ] k =1 k =0 7 Lucas Parra, CCNY City College of New York z-Transform -rational impulse response Note that any polynomial of order -Q can be decomposed into Q factors of the form, (1-z z-1), with roots z . k k Q Q −k −1 ∑ b[k ] z =b[0]∏ (1− zk z ) k =0 k =1 Example: Factor representation of square polynomial with roots z and z 1 2 2 (z−z1)(z− z2)=z −z( z1+ z 2)+ z1 z2 −1 −1 −1 −2 (1− z1 z )(1− z2 z )=1−(z1+ z2)z + z1 z2 z Coefficients of the second b[0]=1,b[1]=−z −z ,b[2]=z z order polynomial are then: 1 2 1 2 For b[k] z use z use k +or k b$k] >> z=roots(b); >> b=poly(z); * Lucas Parra, CCNY City College of New York z-Transform -Pole-zero representation of IR Since a[k] and b[k] define polynomials in z-1 this lead to the pole- zero representation of the impulse response: Q −1 ∏ (1−z k z ) B( z) k=1 H (z) = =b[0] P A( z) −1 ∏ (1− pk z ) k=1 For P=0 the system is called all zeros, for Q=0 it is called all poles. See Bruce, page 296 for dependence of h[n] on location of poles. >> plot(filter(b(1)*poly(z),poly(p),[1 zeros(1,100)])) A rational H(z) is stable if the poles |p | < 1. Hence stability test: k >> abs(roots(a))<1 See Bruce for proof on page 450. , Lucas Parra, CCNY City College of New York z-Transform Homework: Poles location and Impulse response Plot the impulse response for filters with the following configuration of poles (see below figure for definition of quadrants) 1. TWO conjugate poles, one in quadrant I and the conjugate in quadrant IV. 2. TWO conjugate poles, one in quadrant II and the conjugate in quadrant III. 3. ONE pole in quadrant I. 4. TWO conjugate poles outside of the unit circle. The final output of your homework should be 4 figures, each figure should be the impulse response of each pole configuration tried. For the zeros, you can try any combination you want. 1% Lucas Parra, CCNY City College of New York Discrete Time Fourier Transform (DTFT) The Discrete Time Frourier Transform (DTFT) is the z- transform on the unit circle z=e j ω=cos(ω)+ j sin (ω) ∞ X (e j ω)= ∑ x[n]e− j nω n=−∞ The DTFT is an invertible transformation π 1 j ω j nω x[n]= ∫ d ω X (e )e 2π −π − j ω n This is simply because d ω e =2π δ ∫2π n π ∞ π 1 j ω j nω 1 − j ω (k−n) ∫ d ω X (e )e = ∑ x[k ]∫ d ωe =x[n] 2π −π 2π k=−∞ −π 11 Lucas Parra, CCNY City College of New York Fourier Transform Summary +ourier transform 1is rete time FT ( ont. time, cont. fre0.) (dis . time, cont. fre0.) ∞ ∞ F(ν)=∫ dt f (t)e− j2π νt X (e j ω)= ∑ x[n]e− j nω −∞ n=−∞ ∞ π j 2π νt 1 f (t)=∫ d ν F (ν)e x[n]= ∫ dω X (e j ω)e j nω −∞ 2π −π +o-rier series 1is rete FT ( ont. time, dis . fre0.) (dis . time, dis . fre0.) T N −1 1 − j k ω t X [k]= x[n]e− j 2 kn/ N ak= ∫ dt x(t)e ∑ 2T −T n=0 ∞ jk ω t N−1 x(t)= a e 1 j 2 kn/ N ∑ k x[n]= ∑ X [k ]e k=−∞ N k=0 12 Lucas Parra, CCNY City College of New York DTFT - Properties The following properties derive directly from the z-transform x[n] 1T+T X (e j ω ) ∗ ∗ − j ω Conjugation x [ n] X (e ) − j ω n0 j ω Delay x[n−n0] e X (e ) Time reversal x[−n] X (e− j ω) Correlation ∞ ∑ x[n+ k] y∗ [n] X (e j ω )Y ∗(e j ω) n=−∞ Conjugate symmetry for x[n]∈ℝ X (e j ω)= X ∗ (e− j ω) 13 Lucas Parra, CCNY City College of New York DTFT - System frequency response Consider stationary oscillatory input to a LSI system h[k]: x[n]=e j nω ∞ ∞ y[n]= ∑ h[k ] x[n−k ]= ∑ h[k] e j (n−k )ω=H (e j ω)e j nω k =−∞ k=−∞ The output is the input times the DTFT of the impulse response e j nω H (e j ω)e j nω H ( e j ω) The oscillation with frequency ω has been modified in phase and amplitude A j ω j ω A(ω)=∣H (e )∣ (ω)=arg( H (e )) j ω j H (e )= Ae 14 Lucas Parra, CCNY City College of New York DTFT - System frequency response DTFT inversion formula tells us that arbitrary input x[n] can be decomposed into sum of oscillations π 1 j ω j nω x[n]= ∫ d ω X (e )e 2π −π The system response to that is given by the convolution theorem Y (e j ω )=H (e j ω) X (e j ω) X(exp(jω )) 1 H(exp(jω )) 1 x$n] X(exp(jω )) y$n] 2 H(exp(jω )) -1 1T+T 2 1T+T X(exp(jω )) 3 H(exp(jω )) 3 ... 15 Lucas Parra, CCNY City College of New York DTFT - System frequency response 0.1 Example: a[1] = -0.9, b[0] = 0.1: H (z)= 1−0.9z−1 Time domain response Frequency domain response >> plot(filter(b,a,u)) >> freqz(b,a) 16 Lucas Parra, CCNY City College of New York DTFT - Filter design example Goal: Highpass filter the DC drift in EEG with minimal latency and memory. >> sptool Solution: Select IIR filter, 2nd order Butterworth with cutoff at 1Hz. Downside to DC removal is long phase delay for eye blinks. 17 Lucas Parra, CCNY City College of New York DTFT – Group delay Phase delay j(ω) corresponds to delay in time, t, that is frequency dependent: Group delay in samples Group delay in time ϕ (ω) n(ω) f = ω f n(ω)= ω t(ω)= s f s 2π To avoid phase distortions it is desirable to have a constant group delay, i.e.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages42 Page
-
File Size-