Today

ESE 531: Digital ! IIR Filter Design " Impulse Invariance

" Bilinear Transformation Lec 18: March 30, 2017 ! Transformation of DT Filters IIR Filters and Adaptive Filters ! Adaptive Filters ! LMS Algorithm

Penn ESE 531 Spring 2017 – Khanna Penn ESE 531 Spring 2017 - Khanna 2

IIR Filter Design Impulse Invariance

! Transform continuous-time filter into a discrete- ! Want to implement continuous-time system in time filter meeting specs discrete-time

" Pick suitable transformation from s (Laplace variable) to z (or t to n)

" Pick suitable analog Hc(s) allowing specs to be met, transform to H(z)

! We’ve seen this before… impulse invariance

Penn ESE 531 Spring 2017 - Khanna 3 Penn ESE 531 Spring 2017 - Khanna 4

Impulse Invariance Impulse Invariance

! With Hc(jΩ) bandlimited, choose ! With Hc(jΩ) bandlimited, choose

j ω j ω H(e ω ) = H ( j ), ω < π H(e ω ) = H ( j ), ω < π c T c T

! With the further requirement that T be chosen such ! With the further requirement that T be chosen such that that

Hc ( jΩ) = 0, Ω ≥ π / T Hc ( jΩ) = 0, Ω ≥ π / T

h[n] = Thc (nT )

Penn ESE 531 Spring 2017 - Khanna 5 Penn ESE 531 Spring 2017 - Khanna 6

1 IIR by Impulse Invariance Example

jω ! If Hc(jω)≈0 for |ωd| > π/T, no and H(e ) = H(jω/T), ω<π jω ! To get a particular H(e ), find corresponding Hc and Td for which above is true (within specs)

! Note: Td is not for aliasing control, used for frequency scaling.

Penn ESE 531 Spring 2017 - Khanna 7 Penn ESE 531 Spring 2017 - Khanna 8

Example Example

1 eat ←⎯L→ s − a

Penn ESE 531 Spring 2017 - Khanna 9 Penn ESE 531 Spring 2017 - Khanna 10

Example Example

Penn ESE 531 Spring 2017 - Khanna 11 Penn ESE 531 Spring 2017 - Khanna 12

2 Impulse Invariance Impulse Invariance

! Sampling the impulse response is equivalent to mapping the ! Let, H ( jΩ) = 0, Ω ≥ π / T c s-plane to the z-plane using: h[n] =Th (nT ) st0 jω c " z = e = r e ! If sampling at then ! The entire Ω axis of the s-plane wraps around the unit circle ∞ ⎡ ⎤ of the z-plane an infinite number of times jω T1 ⎛ω 2πk ⎞ H(e ) H j ! = ∑ c ⎢ ⎜ − ⎟⎥ The negative half s-plane maps to the interior of the unit T k=−∞ ⎣ ⎝T T ⎠⎦ circle and the RHP to the exterior ! This means stable analog filters (poles in LHP) will transform to stable digital filters (poles inside unit circle) jω T1 ⎛ ω ⎞ ! This is a many-to-one mapping of strips of the s-plane to H(e ) = Hc ⎜ j ⎟, |ω|<π T ⎝ T ⎠ regions of the z-plane " Not a conformal mapping st0 " The poles map according to z = e , but the zeros do not always

Penn ESE 531 Spring 2017 - Khanna 13 Penn ESE 531 Spring 2017 - Khanna 14

Impulse Invariance Mapping Impulse Invariance Mapping

Penn ESE 531 Spring 2017 - Khanna 15 Penn ESE 531 Spring 2017 - Khanna 16

Impulse Invariance Bilinear Transformation

! Limitation of Impulse Invariance: overlap of images ! The technique uses an algebraic transformation of the frequency response. This prevents it from between the variables s and z that maps the entire being used for high-pass filter design jΩ-axis in the s-plane to one revolution of the unit circle in the z-plane.

Penn ESE 531 Spring 2017 - Khanna 17 Penn ESE 531 Spring 2017 - Khanna 18

3 Bilinear Transformation Bilinear Transformation

ω ! Substituting s = σ+ j Ω and z = ej

Penn ESE 531 Spring 2017 - Khanna 19 Penn ESE 531 Spring 2017 - Khanna 20

Bilinear Transformation Example: Notch Filter

! The continuous time filter with:

s2 +Ω2 H (s) 0 a = 2 2 s + Bs +Ω0

Penn ESE 531 Spring 2017 - Khanna 21 Penn ESE 531 Spring 2017 - Khanna 22

Transformation of DT Filters Transformation of DT Filters

Z −1 = G(z−1) Z −1 = G(z−1) Hlp(Z) Hlp(Z)

! Z – complex variable for the LP filter ! Map Z-plane#z-plane with transformation G ! z – complex variable for the transformed filter

! Map Z-plane#z-plane with transformation G

Penn ESE 531 Spring 2017 - Khanna 23 Penn ESE 531 Spring 2017 - Khanna 24

4 Example 1: Example 1:

! Lowpass#highpass ! Lowpass#highpass

" Shift frequency by π " Shift frequency by π

Z −1 = −z−1 Z −1 = −z−1

Penn ESE 531 Spring 2017 - Khanna 25 Penn ESE 531 Spring 2017 - Khanna 26

Example 2: Example 2:

! Lowpass#bandpass ! Lowpass#bandpass Z −1 = −z−2 Z −1 = −z−2 1 1 1 1 Hlp (z) = ⎯⎯→ Hbp (z) = Hlp (z) = ⎯⎯→ Hbp (z) = 1− az−1 1+ az−2 1− az−1 1+ az−2 Pole at z=a Pole at z=±j√a Pole at z=a Pole at z=±j√a

! Lowpass#bandstop Z −1 = z−2 1 1 Hlp (z) = ⎯⎯→ Hbs (z) = 1− az−1 1− az−2

Penn ESE 531 Spring 2017 - Khanna 27 Penn ESE 531 Spring 2017 - Khanna Pole at z=±√a 28

Transformation Constraints on G(z-1) Transformation Constraints on G(z-1)

! If Hlp(Z) is the rational system function of a causal ! Respective unit circles in both planes and stable system, we naturally require that the transformed system function H(z) be a rational function and that the system also be causal and stable. -l -1 " G(Z ) must be a rational function of z

" The inside of the unit circle of the Z-plane must map to the inside of the unit circle of the z-plane

" The unit circle of the Z-plane must map onto the unit circle of the z-plane.

Penn ESE 531 Spring 2017 - Khanna 29 Penn ESE 531 Spring 2017 - Khanna 30

5 Transformation Constraints on G(z-1) Transformation Constraints on G(z-1)

! Respective unit circles in both planes ! Respective unit circles in both planes

Z −1 = G(z−1) Z −1 = G(z−1) e− jθ = G(e− jω ) e− jθ = G(e− jω ) − jω − jω e− jθ = G(e− jω ) e j∠G(e ) e− jθ = G(e− jω ) e j∠G(e )

j 1= G(e− ω ) −θ = ∠G(e− jω )

Penn ESE 531 Spring 2017 - Khanna 31 Penn ESE 531 Spring 2017 - Khanna 32

Transformation Constraints on G(z-1) General Transformation

! General form that meets all constraints: ! Lowpass#lowpass

" ak real and |ak|<1

! Changes passband/stopband edge frequencies

Penn ESE 531 Spring 2017 - Khanna 33 Penn ESE 531 Spring 2017 - Khanna 34

General Transformation General Transformation

! Lowpass#lowpass ! Lowpass#lowpass

! Changes passband/stopband edge frequencies ! Changes passband/stopband edge frequencies

Penn ESE 531 Spring 2017 - Khanna 35 Penn ESE 531 Spring 2017 - Khanna 36

6 General Transformations Reminder: Simple Low Pass Filter

H(e jω ) (dB - Log scale)

1 1 2

ω ω c π

Penn ESE 531 Spring 2017 – Khanna Penn ESE 531 Spring 2017 - Khanna 37 Adapted from M. Lustig, EECS Berkeley 38

The Filtering Problem Adaptive Filters

! Filters may be used for three information-processing tasks ! An adaptive filter is an adjustable filter that

" Filtering processes in time

" It adapts…

" Smoothing d[n] + x[n] Adaptive y[n] _ " Prediction Filter e[n]=d[n]-y[n]

! Given an optimality criteria we often can design optimal filters Update " Requires a priori information about the environment Coefficients ! Adaptive filters are self-designing using a recursive algorithm

" Useful if complete knowledge of environment is not available a priori

Penn ESE 531 Spring 2017 – Khanna 39 Penn ESE 531 Spring 2017 - Khanna 40

Adaptive Filter Applications Adaptive Filter Applications

! System Identification ! Identification of inverse system

Penn ESE 531 Spring 2017 - Khanna 41 Penn ESE 531 Spring 2017 - Khanna 42

7 Adaptive Filter Applications Adaptive Filter Applications

! Adaptive Interference Cancellation ! Adaptive Prediction

Penn ESE 531 Spring 2017 - Khanna 43 Penn ESE 531 Spring 2017 - Khanna 44

Stochastic Gradient Approach Least-Mean-Square (LMS) Algorithm

! Most commonly used type of Adaptive Filters ! The LMS Algorithm consists of two basic processes ! Define cost function as mean-squared error " Filtering process

" " Difference between filter output and desired response Calculate the output of FIR filter by convolving input and taps " Calculate estimation error by comparing the output to desired ! Based on the method of steepest descent signal

" Move towards the minimum on the error surface to get to " Adaptation process minimum " Adjust tap weights based on the estimation error " Requires the gradient of the error surface to be known

45 46

Adaptive FIR Filter: LMS Adaptive FIR Filter: LMS

Penn ESE 531 Spring 2017 - Khanna 47 Penn ESE 531 Spring 2017 - Khanna 48

8 Adaptive FIR Filter: LMS LMS Algorithm Steps

! Filter output M −1 y⎡n⎤ x⎡n k⎤h* ⎡n⎤ ⎣ ⎦ = ∑ ⎣ − ⎦ k ⎣ ⎦ k=0 ! Estimation error ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ e⎣n⎦ = d⎣n⎦− y⎣n⎦

! Tap-weight adaptation h ⎡n 1⎤ h ⎡n⎤ x⎡n k⎤e* ⎡n⎤ k ⎣ + ⎦ = k ⎣ ⎦+ µ ⎣ − ⎦ ⎣ ⎦ Input Signal x[i] x[i-1] x[i-M+1] x[i-M]

* h *[n] h *[n] * h0 [n] 1 M-1 hM [n]

Penn ESE 531 Spring 2017 - Khanna 49 50

Adaptive Filter Applications Adaptive Interference Cancellation

! Adaptive Interference Cancellation

Penn ESE 531 Spring 2017 - Khanna 51 Penn ESE 531 Spring 2017 - Khanna 52

Stability of LMS Admin

! The LMS algorithm is convergent in the mean square if and ! HW 7 posted after class tonight only if the step-size parameter satisfy " Due 4/6 2 0 < µ < λmax ! Here λmax is the largest eigenvalue of the correlation matrix of the input data ! More practical test for stability is 2 0 < µ < input signal power

! Larger values for step size

" Increases adaptation rate (faster adaptation)

" Increases residual mean-squared error Penn ESE 531 Spring 2017 – Khanna 53 Adapted from M. Lustig, EECS Berkeley 54

9