ECE4330 Lecture 24 Discrete-Time Fourier Transform (DTFT): Application to LTID System Analysis and Digital Filter Design Prof. Mohamad Hassoun

This Lecture covers the following topics

 Background: Connections with continuous-time systems  The Sampling of 푓(푡) to obtain the sequence 푓[푘]: A brief review  Fourier transform of discrete-time signals (DTFT)  Connections between the DTFT and the Z-transform  Discrete-time linear system analysis using the DTFT  Response of a discrete-time system to an everlasting sinusoid  Digital filter design based on analog filter approximations: o Impulse-invariance method: Numerical integration example o Impulse-invariance (direct) poles mapping method o The bilinear transformation  Frequency domain-based digital filter design  Matlab’s digital filter design tool: fdatool  Nonlinear LSE-based digital filter design  Numerical methods as recursive filters: Error analysis o Trapezoidal integration rule o Simpson’s 1/3 integration rule  Appendix: General summary

Background: Connections with Continuous-Time Systems

In previous lectures we have introduced the Fourier transform that allowed us to analytically represent a continuous-time (CT) aperiodic signal in terms of the radian frequency, 휔, as +∞ 푓(푡) ↔ 퐹(휔) = ∫ 푓(푡)푒−푗휔푡푑푡 −∞ We will refer to this transformation as the CTFT.

For example, we have derived earlier the CTFT pair,

1 푓(푡) = 푒−푎푡푢(푡) ↔ 퐹(휔) = (푎 > 1) 푎 + 푗휔

Tables of Fourier transform pairs and Fourier transform properties are available. The Fourier transform was also applied to a stable, continuous- time linear system which allowed us to transform the system’s linear differential equation representation (with zero initial state) into a rational function representation (frequency response function) of the form,

퐾(푗휔 − 푧 )(푗휔 − 푧 ) … (푗휔 − 푧 ) 퐻(휔) = 1 2 푚 (푗휔 − 훾1)(푗휔 − 훾2) … (푗휔 − 훾푛) where the 푧푖 and the 훾푖 are the zeros and poles of 퐻(휔), respectively. This rational function is the Fourier transform of the system’s unit-impulse response, ℎ(푡) ↔ 퐻(휔). The frequency response 퐻(휔) can also be obtained (for stable linear systems) by simply making the substituting 푠 = 푗휔 in the expression for the system’s transfer function, 퐻(푠).

Given a causal input signal 푓(푡)푢(푡), with Fourier transform 퐹(휔), the zero-state frequency-domain response, 푌푧푠(휔), of a stable linear system with frequency response 퐻(휔) is given by,

푌푧푠(휔) = 퐻(휔)퐹(휔) with a corresponding time-domain zero-state response given by

−1 푦푧푠(푡) = 퐹 {퐻(휔)퐹(휔)}

If the input signal 푓(푡) is the everlasting sinusoid 푓(푡) = 퐶cos(휔0푡 + 휃) [푓(푡) = 퐶0 is a special case where 휔0 = 0] or, more generally, periodic with Fourier series ∞

푓(푡) = 퐶0 + ∑ 퐶푛 cos(푛휔0푡 + 휃푛) 푛=1 then, the zero-state response becomes the steady-state response, 푦푧푠(푡) = 푦푠푠(푡). The steady-state response can be obtained using the formula ∞

푦푠푠(푡) = 퐻(0)퐶0 + ∑|퐻(푛휔0)|퐶푛 cos[푛휔0푡 + ∠퐻(푛휔0) + 휃푛] 푛=1 This lecture answers the following questions in connection with a discrete- time signal 푓[푘] and a stable LTDI system with impulse response ℎ[푘] (or, equivalently, a stable system with a known LTI difference equation):  Is there a discrete-time Fourier transform (DTFT) for 푓[푘]?  How can one obtain the DTFT for 푓[푘]? How can the inverse transformation be obtained?  What are the properties of the DTFT?  How can one obtain the system’s frequency response function?  How can one obtain the zero-state and steady-state responses?  How can we design a discrete-time filter that is equivalent to a continuous-time (analog) filter?

The following is a summary of the three transformation methods that we had utilized in this course along with the DTFT that will be covered in the rest of this lectures. Refer to the appendix for an extended summary.

The Sampling of 푓(푡) to Obtain the Sequence 푓[푘]: A Brief Review

The discrete-time signal (or sequence) 푓[푘] will be assumed to have been obtained by uniformly sampling a continuous-time signal 푓(푡) at uniform intervals of duration 푇푠, or with a corresponding sampling frequency 푓푠 = 1 . We will assume that the sampling frequency satisfies the (equivalent) 푇푠 inequalities 1 푓 > 2퐵, 휔 > 4휋퐵 and 푇 < 푠 푠 푠 2퐵 where 퐵 is the effective bandwidth (in Hz) of the signal 푓(푡). (Refer to Lectures 18 and 23 for bandwidth and sampling rate, respectively.)

For example, for the bandlimited signal 푓(푡) = cos (휔0푡) the sampled signal is obtained by a (discretizing) variable transformation, 푡 → 푇푠푘, to ( ) ( )| ( ) ( ) obtain 푓 푇푠푘 = 푓 푡 푡=푇푠푘 = cos 휔0푇푠푘 = cos Ω0푘 , where we define Ω0 = 푇푠휔0 and 푘 = ⋯ , −2, −1, 0, 1, 2, … . We will refer to Ω0 as the discrete-time angular frequency, measured in rad/sample. Since for a pure 휔0 휋 sinusoid the bandwidth is 퐵 = , we must employ 푇푠 < . Now, we may 2휋 휔0 generate the sequence 푓[푘] by setting its values equal to 푓(푇푠푘). Example. Find a proper sampled signal 푓[푘] for the continuous-time signal 휋 푓(푡) = 3 cos (1500푡 + ) 3 1500 1 This sinusoid has a bandwidth 퐵 = . Any 푇 satisfying 푇 < = 2휋 푠 푠 2퐵 휋 ≅ 0.0021 would allow for adequate reconstruction (by the Sampling 1500

Theorem). So, we can set 푇푠 = 0.001 sec (푓푠 = 1000Hz) to arrive at the sampled signal 휋 휋 푓[푘] = 3 cos (1500(0.001)푘 + ) = 3 cos (1.5푘 + ) 3 3

Notice how the sampling rate 푇푠 = 0.001 leads to a scaled the frequency,

휔0 휔0 = 1500 rad/sec → Ω0 = 푇푠휔0 = = 1.5 rad/sample 푓푠

휋 Your turn: Plot 푓[푘] = 3 cos (1.5푘 + ) and compare it to 푓(푡). 3

We should avoid making 푇푠 unnecessarily small because that would lead to a reduction in speed when digital processors are used to process the sampled signal.

It should be emphasized that once the samples are taken from 푓(푡) and stored in memory (in digital/quantized form), the time scale is lost. The discrete-time signal is just a sequence of numbers, and these numbers carry no information about the sampling period, 푇푠. Therefore, the process that generates the discrete-time sequence, 푓[푘], from the continuous-time signal, 푓(푡), performs two operations:

1. It samples the signal 푓(푡) every 푇푠 seconds and assigns the value 푓(푇푠푘) to the 푘th sample of the sequence, 푓[푘]. 2. It scales (normalizes) the time axis by 푘 = 푡/푇푠, so that the distance between successive samples is always unity. Thus, it changes the time axis from 푡 to its normalized integer time, 푘.

In Lecture 23, we showed that the CT Fourier transform of the sampled signal 푓(푇푠푘) is, ∞ ∞ 1 휔 퐺(휔) = 퐹(휔) ∗ [휔 ∑ 훿(휔 − 푘휔 )] = 푠 ∑ 퐹(휔 − 푘휔 ) 2휋 푠 푠 2휋 푠 푘=−∞ 푘=−∞

In the above expression, 퐹(휔) is the Fourier transform of 푓(푡) and 휔푠 = 2휋 is the radian sampling frequency. The expression can be rewritten as, 푇푠

퐺(푓) = 푓푠 ∑ 퐹(푓 − 푘푓푠) 푘=−∞

Therefore, the process that generates the discrete-time sequence 푓[푘] from the continuous-time signal 푓(푡) can be viewed, in the frequency domain, as performing the following operations:

1. It scales the spectrum of 푓(푡) by 푓푠. 2. It duplicates the scaled spectrum at all integer multiples of the

sampling frequency, 푘푓푠.

Fourier Transform of Discrete-Time Signals (DTFT)

In analogy to using the Fourier transform to arrive at a frequency-domain characterization of a continuous signal, 푓(푡), we define the discrete-time Fourier transform (DTFT) of the sampled signal (sequence) 푓[푘] as the infinite sum ∞ 퐹(Ω) = ∑ 푓[푘]푒−푗Ω푘 푘=−∞ 휔 where Ω = 푇푠휔 = is the discrete-time angular frequency (measured in 푓푠 rad/sample). As with other transforms, we will describe this relationship between the discrete-time signal and its DTFT as a transform pair, 푓[푘] ↔ 퐹(Ω) It is interesting to note how one can obtain the DTFT of a sampled signal from the (continuous-time) Fourier transform of 푓(푡), as shown next. As we did in the previous lecture, the sampled signal 푓[푘] is obtained by multiplying 푓(푡) by the impulse train 훿푠(푡), ∞

푓(푡)훿푠(푡) = 푓(푡) ∑ 훿(푡 − 푇푠푘) 푘=−∞ Applying the Fourier transformation to the above sampled signal we get

+∞ +∞ ∞ −푗휔푡 −푗휔푡 ∫ 푓(푡)훿푠(푡)푒 푑푡 = ∫ [푓(푡) ∑ 훿(푡 − 푇푠푘)] 푒 푑푡 −∞ −∞ 푘=−∞ ∞ +∞ ∞ −푗휔푡 −푗휔푇푠푘 = ∑ ∫ 푓(푡)푒 훿(푡 − 푇푠푘)푑푡 = ∑ 푓(푇푠푘)푒 푘=−∞ −∞ 푘=−∞

Upon defining Ω = 푇푠휔 and replacing 푓(푇푠푘) by its sample values 푓[푘], in the above expression we arrive at the DTFT, ∞ 퐹(Ω) = ∑ 푓[푘]푒−푗Ω푘 푘=−∞ Example. Find the DTFT of the causal signal 푓[푘] = 훾푘푢[푘] and plot its spectra for 훾 = 0.8. ∞ ∞ ∞ 푘 퐹(Ω) = ∑ 훾푘푢[푘]푒−푗Ω푘 = ∑ 훾푘푒−푗Ω푘 = ∑(훾푒−푗Ω) 푘=−∞ 푘=0 푘=0 is the sum of a geometric series with common ratio 훾푒−푗Ω. The sum converges to 1 푒푗Ω 퐹(Ω) = = 1 − 훾푒−푗Ω 푒푗Ω − 훾 if |훾푒−푗Ω| < 1, but since |푒−푗Ω| = 1, then |훾| < 1 is required for the transform to exist. Therefore, we arrive at our first DTFT pair, 1 푒푗Ω 훾푘푢[푘] ↔ = |훾| < 1 1 − 훾푒−푗Ω 푒푗Ω − 훾 Setting 훾 = 0.8 in the DTFT we obtain 1 퐹(Ω) = 1 − 0.8푒−푗Ω or, equivalently, by employing Euler’s identity we may write 1 퐹(Ω) = 1 − 0.8[cos(Ω) − 푗sin(Ω)]

The magnitude and angle responses are then (your turn: derive them) 1 |퐹(Ω)| = √1 + 0.64 − 1.6 cos(Ω)

0.8 sin(Ω) angle(퐹(Ω)) = − tan−1 ( ) 1 − 0.8 cos(Ω) The following two plots show the spectra of 퐹(Ω).

Observe that the magnitude spectrum is even and that the phase spectrum is odd. This is always true for a real 푓[푘] and leads us to write,

|퐹(Ω)| = |퐹(−Ω)| and ∠퐹(Ω) = −∠퐹(−Ω)

Your turn: Study Example 10.5 in Lathi’s text (pp. 631-632).

Since |퐹(Ω)|2 = 퐹(Ω)퐹∗(Ω), then a convenient formula for obtaining the magnitude response is |퐹(Ω)| = √퐹(Ω)퐹∗(Ω). Utilizing the conjugate symmetry property (easy to prove) of the DTFT, 퐹∗(Ω) = 퐹(−Ω), we have 1 |퐹(Ω)| = √퐹(Ω)퐹(−Ω). Evaluate this last formula for 퐹(Ω) = . 1−0.8푒−푗Ω

It should be emphasized that the spectra is continuous in Ω. More importantly, the spectra is periodic with fundamental period of 2휋. In practice, we choose the fundamental period of the spectrum centered at the origin, −휋 < Ω < π, to characterize the full frequency content of 푓[푘]. The periodicity is present in the DTFT spectra of any sampled signal 푓[푘].

Proof of the periodicity of the DTFT:

∞ ∞ 퐹(Ω ± 2휋푛) = ∑ 푓[푘]푒−푗(Ω±2휋푛)푘 = ∑ 푓[푘]푒−푗Ω푘 푒±푗2휋푛푘 푘=−∞ 푘=−∞ ∞ = ∑ 푓[푘]푒−푗Ω푘 = 퐹(Ω) 푘=−∞

(Note: 푒±푗2휋푛푘 = 1 by Euler’s identity). Therefore,

퐹(Ω) = 퐹(Ω ± 2휋푛)

The following are two useful tables for the DTFT: (1) Table of DTFT Pairs, and (2) Table of DTFT Properties.

Table of DTFT Pairs

훿[푘] ↔ 1 훿[푘 − 푛] ↔ 푒−푗푛Ω ∞ 1 ↔ 2휋 ∑ 훿(Ω − 2휋푛) 푛=−∞ ∞ 푒푗Ω 푢[푘] ↔ + 휋 ∑ 훿(Ω − 2휋푛) 푒푗Ω − 1 푛=−∞ 1 푒푗Ω 훾푘푢[푘] ↔ = |훾| < 1 1 − 훾푒−푗Ω 푒푗Ω − 훾 훾푒푗Ω 푘훾푘푢[푘] ↔ |훾| < 1 (푒푗Ω − 훾)2 ∞

푗Ω0푘 푒 ↔ 2휋 ∑ 훿(Ω − Ω0 − 2휋푛) 푛=−∞ ∞

cos (Ω0푘) ↔ 휋 ∑ [훿(Ω − Ω0 − 2휋푛) + 훿(Ω + Ω0 − 2휋푛)] 푛=−∞ ∞ 휋 sin (Ω 푘) ↔ ∑ [훿(Ω − Ω − 2휋푛) − 훿(Ω + Ω − 2휋푛)] 0 푗 0 0 푛=−∞ 푗2Ω 푗Ω 푘 cos (휃)푒 −훾cos(Ω0 − 휃)푒 훾 cos(Ω0푘 + 휃) 푢[푘] ↔ 푗2Ω 푗Ω 2 |훾| < 1 푒 −2훾 cos(Ω0) 푒 + 훾

Properties of the DTFT

퐿푖푛푒푎푟푖푡푦: 푎푓1[푘] + 푏푓2[푘] ↔ 푎퐹1(Ω) + 푏퐹2(Ω) 푇푖푚푒 푠ℎ푖푓푡: 푓[푘 − 푛] ↔ 퐹(Ω)푒−푗푛Ω 푇푖푚푒 푟푒푣푒푟푠푎푙: 푓[−푘] ↔ 퐹(−Ω)

푗Ω0푘 퐹푟푒푞푢푒푛푐푦 푠ℎ푖푓푡: 푒 푓[푘] ↔ 퐹(Ω − Ω0) 푑퐹(Ω) 푀푢푙푡푖푝푙푖푐푎푡푖표푛 푏푦 푘: 푘푓[푘] ↔ 푗 푑Ω Differencing in time: 푓[푘] − 푓[푘 − 1] ↔ (1 − 푒−푗Ω)퐹(Ω)

푘 1 퐴푐푐푢푚푢푙푎푡푖표푛: ∑ 푓[푛] ↔ 퐹(Ω) + 1 − 푒−푗Ω 푛=−∞ ∞ 휋퐹(0) ∑ 훿(Ω − 2휋푛) 푛=−∞

푇푖푚푒 푐표푛푣표푙푢푡푖표푛: 푓1[푘] ∗ 푓2[푘] ↔ 퐹1(Ω)퐹2(Ω) 1 퐹푟푒푞푢푒푛푐푦 푐표푛푣표푙푢푡푖표푛: 푓 [푘]푓 [푘] ↔ 퐹 (Ω) ∗ 퐹 (Ω) 1 2 2휋 1 2 ∞ 1 푃푎푟푠푒푣푎푙′푠 푡ℎ푒표푟푒푚: 퐸 = ∑ |푓[푘]|2 = ∫ |퐹(Ω)|2푑 Ω 푓 2휋 푘=−∞ 2휋 퐶표푛푗푢푔푎푡푒 푠푦푚푚푒푡푟푦: 퐹∗(Ω) = 퐹(−Ω) 푃푒푟푖표푑푖푐푖푡푦 표푓퐹(Ω) ∶ 퐹(Ω) = 퐹(Ω ± 2푛휋) 푛 = 1, 2, 3, …

Example. Determine and plot the DTFT of 푓[푘] = 훾|푘|, |훾| < 1. We may express 푓[푘] as (can you explain why?)

푓[푘] = 훾|푘| = 훾푘푢[푘] + 훾−푘푢[−푘] − 훿[푘]

푒푗Ω Employing the DTFT pair 훾푘푢[푘] ↔ and the time reversal property, 푓[−푘] ↔ 푒푗Ω−훾 퐹(−Ω), we arrive at

푒푗Ω 푒−푗Ω 퐹(Ω) = + − 1 푒푗Ω − 훾 푒−푗Ω − 훾 푒푗Ω(푒−푗Ω − 훾) + 푒−푗Ω(푒푗Ω − 훾) − (푒푗Ω − 훾)(푒−푗Ω − 훾) = (푒푗Ω − 훾)(푒−푗Ω − 훾) which can be shown to simplify to (try it)

1 − 훾2 퐹(Ω) = 1 − 2훾 cos(Ω) + 훾2 Since 푓[푘] is even and real then its DTFT is even and real, a consequence of the conjugate symmetry property, 퐹∗(Ω) = 퐹(−Ω). The plot of 퐹(Ω) is shown below for 훾 = 0.8 and −π < Ω < π.

Your turn: Repeat the above example employing the definition of the DTFT.

Connections Between the DTFT and the Z-Transform For continuous-time signals, we saw that if a causal signal 푓(푡) is ∞| | absolutely integrable (i.e., ∫0− 푓(푡) 푑푡 < ∞) and has a Laplace transform 퐹(푠), then (and only then) the Fourier transform of 푓(푡) can be obtained from 퐹(푠) as

퐹(휔) = 퐹(푠)|푠=푗휔 A similar connection exists between the DTFT and the Z-transform of a discrete-time signal 푓[푘]. For example, comparing the DTFT pair 푒푗Ω 푧 훾푘푢[푘] ↔ 퐹(Ω) = to the Z-transform pair 훾푘푢[푘] ↔ 퐹(z) = 푒푗Ω−훾 푧−훾 we can see that 퐹(Ω) can be obtained from 퐹(z) by substituting 푒푗Ω for 푧: 푧 푒푗Ω 퐹(Ω) = | = 푗Ω 푧 − 훾 푧=푒푗Ω 푒 − 훾 This should not be surprising since this substitution can be justified by comparing the mathematical definitions of the two transformations (the two-sided Z-transform is assumed here) namely, ∞ ∞ 퐹(Ω) = ∑ 푓[푘]푒−푗Ω푘 and 퐹(푧) = ∑ 푓[푘]푧−푘 푘=−∞ 푘=−∞ which leads to

퐹(Ω) = 퐹(푧)|푧=푒푗Ω Caution: The above substitution does not hold for all signals. For example it does not hold for 푓[푘] = 푢[푘]. It can be shown that the sufficient condition for the substitution 푧 = 푒푗Ω to hold is that 푓[푘] is absolutely ∞ summable; i.e., ∑푘=−∞|푓[푘]| < ∞.

Practice Problems

Your turn: (a) Show that 푓[푘] = 훾푘푢[푘] is absolutely summable (assume that |훾| < 1). (b) Show that 푓[푘] = 푢[푘] is not absolutely summable.

Your turn: Determine the DTFT for the following finite duration signal 푓[푘], and plot its magnitude and angle spectra for Ω ∈ [−3휋 3휋].

푓[−2] = 3, 푓[−1] = 1, 푓[0] = 4, 푓[1] = 2, 푓[2] = 5 and 푓[푘] = 0, otherwise

Hint: start with the representation 푓[푘] = 3훿[푘 + 2] + 훿[푘 + 1] + ⋯

Your turn: Determine the DTFT for the everlasting sinusoid 푓[푘] = cos [Ω0푘], where Ω0 is a constant. Hint: Employ Euler’s identity, the DTFT of 푒푗Ω0푘 and the linearity property.

Your turn: Employ the accumulation property and the pair 훿[푘] ↔ 1 to show that ∞ 푒푗Ω 푢[푘] ↔ + 휋 ∑ 훿(Ω − 2휋푛) 푒푗Ω − 1 푛=−∞

Your turn: Derive the differencing property of the DTFT

푓[푘] − 푓[푘 − 1] ↔ (1 − 푒−푗Ω)퐹(Ω)

Your turn: Verify Parseval’s theorem for the DTFT pair

푒푗Ω 훾푘푢[푘] ↔ with |훾| < 1 푒푗Ω − 훾

The Inverse DTFT The inverse DTFT can be obtained using the following integral, 1 휋 푓[푘] = ∫ 퐹(Ω)푒푗푘Ω푑Ω 2휋 −휋

Example. Let 퐹(Ω) = 1. Determine 푓[푘]. Solution. Using the inverse DTFT definition we may write 1 휋 1 1 푓[푘] = ∫ (1)푒푗푘Ω푑Ω = ( ) ( ) [푒푗푘휋 − 푒−푗푘휋] 2휋 −휋 2휋 푗푘 1 sin(푘휋) 1 if 푘 = 0 = ( ) (2푗sin(푘휋)) = = { 푗2푘휋 푘휋 0 otherwise Therefore, 푓[푘] = 훿[푘] as is expected form the DTFT table of transform pairs. Practice Problems Your turn: Study Example 10.6 in Lathi’s text (pp. 632-633).

Your turn: Find the inverse DTFT of 퐹(Ω) = sin2(Ω) using DTFT properties. (Think Euler!)

Your turn: Employ the inverse DTFT integral to determine 푓[푘] if the DTFT transform of the signal is 1 (a) 퐹(Ω) = 1−푒−푗Ω 1 1 (b) 퐹(Ω) = sin2(Ω) Ans. 훿[푘] − [훿[푘 + 2] + 훿[푘 − 2]] 2 4

Discrete-Time Linear System Analysis Using the DTFT

For the linear time-invariant continuous (LTIC) system with unit-impulse response ℎ(푡), we had determined that the zero-state response for the input 푓(푡) can be determined as 푦푧푠(푡) = ℎ(푡) ∗ 푓(푡). The was then used to transform this equation to obtain 푌푧푠(푠) = 퐻(푠)퐹(푠). The −1 zero-state response can be obtained using 푦푧푠(푡) = 퐿 {퐻(푠)퐹(푠)}. The rational function 퐻(푠) is the system’s transfer function. The notation 퐿−1{ } stands for the inverse Laplace transform.

If the linear system is stable, we could use the Fourier transform to obtain −1 the zero-state response according to 푦푧푠(푡) = 퐹 {퐻(휔)퐹(휔)}. Here, 퐻(휔), the system’s frequency response, is the Fourier transform of ℎ(푡) and 퐹(휔) is the Fourier transform of 푓(푡). The notation 퐹−1{ } stands for the inverse Fourier transform. The Fourier transform allows for causal as well as everlasting signals. Furthermore, if 푓(푡) is constant, sinusoid, or a sum of sinusoid (think Fourier series of a periodic signal) then the −1 expression 퐹 {퐻(휔)퐹(휔)} generates the steady-state response, 푦푠푠(푡).

We also saw that, for linear discrete-time systems, the zero-state response

푦푧푠[푘] can be generated using the Z-transform method. When applied to the convolution equation 푦푧푠[푘] = ℎ[푘] ∗ 푓[푘], the Z-transform leads to 푌푧푠(푧) = 퐻(푧)퐹(푧). And the inverse Z-transform allows us to solve for the −1 discrete-time, zero-state response as 푦푧푠[푘] = 푍 [퐻(푧)퐹(푧)]. The DTFT plays a similar role to that of the CTFT. When applied to the equation 푦푧푠[푘] = 푓[푘] ∗ ℎ[푘], the DTFT generates the equation 푌푧푠(Ω) = 퐻(Ω)퐹(Ω). Here, 퐻(Ω) is the LTID system frequency response function; it exists if the system is stable. Applying the inverse DTFT to both sides of this expression leads to the zero-state response

−1 푦푧푠[푘] = 퐹 {퐻(Ω)퐹(Ω)}

Therefore, for stable LTID systems, this last equation generates the same solution as the one obtained using the Z-transform method, namely, −1 푦푧푠[푘] = 푍 [퐻(푧)퐹(푧)]. We will demonstrate those concepts in the next example. However, the power of the DTFT shines when the input 푓[푘] is a constant or an everlasting sinusoid (or a sum of sinusoids as in a periodic signal). In the later case, 퐹−1{퐻(Ω)퐹(Ω)} returns the steady-state response, 푦푠푠[푘].

Example. Consider the following stable, second-order LTID system. 3 1 푦[푘] − 푦[푘 − 1] + 푦[푘 − 2] = 푓[푘] 4 8 Determine the frequency response function 퐻(Ω) and the impulse response ℎ[푘]. Applying the DTFT to the difference equation and employing the time shift property, 푓[푘 − 푛] ↔ 퐹(Ω)푒−푗푛Ω, and the linearity property we obtain 3 1 푌(Ω) − 푒−푗Ω푌(Ω) + 푒−푗2Ω푌(Ω) = 퐹(Ω) 4 8 or 3 1 (1 − 푒−푗Ω + 푒−푗2Ω) 푌(Ω) = 퐹(Ω) 4 8 Therefore, 푌(Ω) 1 1 퐻(Ω) = = 3 1 = 1 1 퐹(Ω) 1 − 푒−푗Ω + 푒−푗2Ω (1 − 푒−푗Ω)(1 − 푒−푗Ω) 4 8 2 4 Applying partial-fraction expansion to the above rational function (rational in the 푒−푗Ω variable) gives

1 2 −1 퐻(Ω) = 1 1 = 1 + 1 (1 − 푒−푗Ω)(1 − 푒−푗Ω) 1 − 푒−푗Ω 1 − 푒−푗Ω 2 4 2 4 (Hint: The notation can be simplified if we rename 푒푗Ω as 푧, or some other symbol, while performing the PFE) Taking the inverse DTFT (with the aid of the DTFT Table of Transforms) we obtain

1 푘 1 푘 ℎ[푘] = [2 ( ) − ( ) ] 푢[푘] 2 4 Note: The system is stable because its natural frequencies have magnitudes less than unity.

Your turn: Show that applying the Z-transform method to the system in the above example leads to the same answer.

Your turn: Employ the DTFT analysis method to determine the unit- impulse response (i.e., response due to 푓[푘] = 훿[푘]) for the following stable LTID system 1 1 푦[푘] − 푦[푘 − 1] = 푓[푘] + 푓[푘 − 1] 2 2 1 푘 = 0 1 푘 1 1 푘−1 Ans. ℎ[푘] = ( ) 푢[푘] + ( ) 푢[푘 − 1] = { 1 푘 2 2 2 2 ( ) 푘 ≥ 1 2 Example. Use the DTFT to find the zero-state response for a LTID system with 푓[푘] = 퐴 and ℎ[푘] = 훾푘푢[푘]. Assume |훾| < 1.

First, we look up the DTFT of the two signals in the DTFT Table to obtain ∞ 퐴 ↔ 2휋퐴 ∑ 훿(Ω − 2휋푛) 푛=−∞ 1 훾푘푢[푘] ↔ 1 − 훾푒−푗Ω Therefore, the zero-state response is given by the formula

∞ 1 푦 [푘] = 퐹−1{퐻(Ω)퐹(Ω)} = 퐹−1 { (2휋퐴) ∑ 훿(Ω − 2휋푛)} 푧푠 1 − 훾푒−푗Ω 푛=−∞ ∞ 퐴 = 퐹−1 {2휋 ∑ 훿(Ω − 2휋푛)} 1 − 훾푒−푗Ω 푛=−∞ ∞ 퐴 = 퐹−1 {2휋 ∑ 훿(Ω − 2휋푛)} 1 − 훾푒−푗2휋푛 푛=−∞ where we have used the sampling property of the unit-impulse function, 푓(푥)훿(푥 − 푎) = 푓(푎)훿(푥 − 푎). Now, realizing that 푒푗2휋푛 = 1 we may express the above equation as, ∞ 퐴 퐴 퐴 푦 [푘] = 퐹−1 {2휋 ∑ 훿(Ω − 2휋푛)} = (1) = 푧푠 1 − 훾 1 − 훾 1 − 훾 푛=−∞ 퐴 Therefore, 푦 [푘] = , a constant. This is also the steady-state response 푧푠 1−훾 since the input is everlasting. A much more efficient method for determining the steady-state response is described in the next section; a method reminiscent of the phasors method for LTIC systems.

휋 Your turn: Repeat the last example for 푓[푘] = cos ( 푘). Let 훾 = 0.8. 6

Example. Consider the following LTID system.

a. Determine the system’s frequency response function, 퐻(Ω). b. Determine the unit-impulse response, ℎ[푛]. c. Sketch the magnitude response and the angle response, and determine the filter type.

d. Solve for the 3-dB cutoff frequency, Ω3dB. Solution. The difference equation can be determined from the block diagram as 푦[푛] = 푥[푛] + 푥[푛 − 1]. Applying the DTFT to the difference equation and solving for the ratio 푌(Ω)/X(Ω) we obtain, 퐻(Ω) = 1 + 푒−푗Ω The unit impulse response is given by the inverse DTFT of 퐻(Ω),

ℎ[푛] = 퐹−1(1 + 푒−푗Ω) = 퐹−1(1) + 퐹−1(1푒−푗Ω) = 훿[푛] + 훿[푛 − 1] The system is FIR since ℎ[푛] has finite duration, 1 푛 = 0, 1 ℎ[푛] = { 0 otherwise We can manipulate 퐻(Ω) and express it in exponential form by first 푗Ω − extracting a 푒 2 term to get

푗Ω 푗Ω 푗Ω − − 퐻(Ω) = 푒 2 (푒 2 + 푒 2 )

Employing Euler’s identity for the cosine we obtain

푗Ω 푗Ω − Ω Ω − 퐻(Ω) = 2푒 2 cos ( ) = 2 cos ( ) 푒 2 2 2 훺 Therefore, we may write |퐻(Ω)| = 2 cos ( ), with periodicity of 2휋. And 2 Ω the angle response is angle(퐻(Ω)) = − . The magnitude and angle 2 spectra are shown below.

The filter is a low pass filter. The cutoff frequency is the solution of the 2 equation, |퐻(Ω )| = √ (max|퐻(Ω)|), 3dB 2 Ω √2 2 cos ( 3푑퐵) = (2) 2 2 Ω √2 Ω 휋 휋 cos ( 3푑퐵) = → 3푑퐵 = → Ω = 2 2 2 4 3푑퐵 2

Your turn: Repeat the above example assuming the following system.

Your turn: Consider the stable LTID system described by its frequency response, 푌(Ω) [cos(Ω) − 1] − 푗sin(Ω) 퐻(Ω) = = 퐹(Ω) [cos(2Ω) − cos(Ω) + 0.21] + 푗[sin(2Ω) − sin(Ω)] Show that the system is governed by the second-order LTI difference equation 푦[푛] − 푦[푛 − 1] + 0.21푦[푛 − 2] = 푓[푛 − 1] − 푓[푛 − 2]

Your turn: Consider the feedback system shown below. Determine 푌(Ω) 퐻(Ω) = . Plot the magnitude and angle spectra assuming 퐾 = 1 and 퐹(Ω) 1 퐾2 = 0.8 .

Example. Consider the three-point moving average LTID system 1 푦[푘] = (푓[푘] + 푓[푘 − 1] + 푓[푘 − 2]) 3 Determine its frequency response. Solution: This system was analyzed in Lecture 21 to obtain its zero-state response where by applying the 푧-transform we obtained the transfer function 푌(푧) 1 퐻(푧) = = (1 + 푧−1 + 푧−2) 퐹(푧) 3

Since the system is stable (Your turn: show that poles are at 푧1,2 = 0) we may sybstitute 푧 = 푒푗Ω and obtain the frequency response,

2 1 퐻(Ω) = (1 + 푒−푗Ω + 푒−푗2Ω) = ∑(푒−푗Ω)푛 3 푛=0 Employing the finite sum of a geometric series (푎 ≠ 1)

푁 1 − 푎푁+1 ∑ 푎푛 = 1 − 푎 푛=0 and setting 푎 = 푒−푗Ω and 푁 = 2 leads to 1 1 − 푒−푗3Ω 퐻(Ω) = ( ) 3 1 − 푒−푗Ω Next, employing the identity

훼Ω 훼Ω 훼Ω −푗 푗 −푗 1 − 푒−푗훼Ω = 푒 2 (푒 2 − 푒 2 )

Leads to

3Ω 3Ω 3Ω −푗 푗 −푗 3Ω 푒 2 (푒 2 − 푒 2 ) sin ( ) 1 1 2 −푗Ω 퐻(Ω) = ( ) Ω Ω Ω = 푒 3 −푗 푗 −푗 3 Ω 2 2 2 sin ( ) 푒 (푒 − 푒 ) 2

Euler’s identity, 푒푗푥 = cos(푥) + 푗sin(푥), was used to obtain the righ hand side term in the above expression. The magnitude response is then

3Ω 1 sin ( ) | ( )| 2 퐻 Ω = | Ω | 3 sin ( ) 2 and the phase response is 2휋 −Ω 푖푓 |Ω| < 휃(Ω) = { 3 2휋 −Ω + 휋 푖푓 < |Ω| < 휋 3 The plots are shown below. Note the low-pass characteristics of this system. The system is a low-pass FIR filter with linear phase.

Response of a Discrete-Time System to an Everlasting Sinusoid

As was noted at the beginning of this lecture (and in an earlier lecture), if the input signal 푓(푡), to a stable LTIC system, is an everlasting sinusoid 푓(푡) = 퐶cos(휔0푡 + 휃) or, more generally, periodic with Fourier series

푓(푡) = 퐶0 + ∑ 퐶푛 cos(푛휔0푡 + 휃푛) 푛=1 then 푦푧푠(푡) = 푦푠푠(푡). The response can be obtained using the formula ∞

푦푠푠(푡) = 퐻(0)퐶0 + ∑|퐻(푛휔0)|퐶푛 cos[푛휔0푡 + ∠퐻(푛휔0) + 휃푛] 푛=1

A similar result holds for a stable LTID systems. Here, if the input is

푓[푘] = 퐶cos(Ω0푘 + 휃) then the response is

푦푠푠[푘] = |퐻(Ω0)|퐶cos[Ω0푘 + ∠퐻(Ω0) + 휃] More generally, for the input 푚

푓[푘] = 퐶0 + ∑ 퐶푖cos (Ω푖푘 + 휃푖) 푖=1 the response is 푚

푦푠푠[푘] = 퐻(0)퐶0 + ∑|퐻(Ω푖)|퐶푖 cos[Ω푖푘 + ∠퐻(Ω푖) + 휃푖] 푖=1

Example. Use the above formula to find the steady-state response for a (stable) LTID system with 푓[푘] = 퐴 and ℎ[푘] = 훾푘푢[푘]. Assume |훾| < 1. The frequency response for this system is 1 퐻(Ω) ↔ 1 − 훾푒−푗Ω Since the input is an everlasting constant, the steady-state response can then be obtained using the formula 퐴 퐴 푦 [푘] = 퐻(0)퐴 = 퐻(0)퐴 = = 푠푠 1 − 훾푒0 1 − 훾 Note: This same result was obtained in the previous section using the more elaborate “direct” DTFT method.

Example. Determine and plot the response of the system 1 퐻(Ω) ↔ 1 − 0.8푒−푗Ω 휋 for the input 푓[푘] = 3 cos ( 푘 − 0.2). 6 Since the system is stable (|0.8| < 1) and the input is an everlasting sinusoid, we use the formula

푦푠푠[푘] = |퐻(Ω0)|퐶cos[Ω0푘 + ∠퐻(Ω0) + 휃] 휋 휋 휋 = |퐻 ( )| (3)cos [ 푘 + ∠퐻 ( ) − 0.2] 6 6 6 The magnitude and angle of the frequency response were determined in a 휋 previous example. And when evaluated at Ω = we obtain, 6

휋 1 |퐻 ( )| = = 1.983 6 휋 √1 + 0.64 − 1.6 cos ( ) 6

휋 0.8 sin ( ) 휋 −1 6 ∠퐻 ( ) = − tan ( 휋 ) = − 0.916 6 1 − 0.8 cos ( ) 6

Therefore, the steady-state response is 휋 휋 푦 [푘] = (1.983)(3)cos [ 푘 − 0.916 − 0.2] ≅ 5.95 cos ( 푘 − 1.12) 푠푠 6 6 which is plotted along with the input signal in the following figure.

Your turn: Determine and plot the steady-state response of the following 휋 stable linear system, assuming the input 푓[푘] = cos ( 푘). 6 1 퐻(z) = 3 1 1 − 푧−1 + 푧−2 4 8

Digital Filter Design Based on Analog Filter Approximations The appeal of digital filters hinges on the fact that a continuous-time system can be efficiently simulated on a digital computer, in real time. So, given an analog filter with transfer function 퐻(푠), input 푓(푡) and output 푦(푡) we would like to obtain an equivalent (or, in practice, approximate) 퐻(푧) from which a difference equation is generated and then implemented as a recursion formula on a digital computer. In addition, since the computer can only deal with discrete-time signals (as opposed to continuous signals) we will assume that the input is a sequence 푓[푘], 1 obtained by sampling 푓(푡) at a rate 푓푠 = . This means that 푓[푘] = 푇푠 푓(푇푠푘). The filter’s output is also a discrete-time signal, 푦[푘]. Sampling and reconstruction circuits are used to generate 푓[푘] from 푓(푡) and 푦̃(푡) from 푦[푘], respectively, as we saw in the previous lecture.

The reconstructed output of the digital implementation, 푦̃(푡), can only be an approximation of the analog filter output, 푦(푡). In digital filter design the objective is to synthesize 퐻(푧) that will minimize the error between 푦̃(푡) and 푦(푡). These ideas are depicted in the following figure.

Impulse-invariance method: Numerical integration example

The following is an example that employs the above ideas to design a (digital) discrete-time low-pass filter that approximates the behavior of the first-order analog low-pass filter 푌(푠) 1 퐻(푠) = = 퐹(푠) 푠 + 0.223 We will work in the time domain. The differential equation representing the analog system can be obtain employing the inverse Laplace transformation according to 퐿−1{(푠 + 0.223)푌(푠)} = 퐿−1{퐹(푠)} or 푦̇(푡) + 0.223푦(푡) = 푓(푡) → 푦̇(푡) = 푓(푡) − 0.223푦(푡)

We may solve the above differential equation numerically employing the derivative approximation at time 푘 1 푦̇(푡)| ≅ {푦[푘 + 1] − 푦[푘]} 푡=ℎ푘 ℎ

This leads to Euler’s integration formula (covered in standard numerical methods course) given by the recursion 푦[푘 + 1] = 푦[푘] + ℎ{푓[푘] − 0.223푦[푘]} where ℎ is a small positive constant. The recursion can be initiated with some initial value 푦[0].

The transfer function 퐻(z) of the discrete-time filter can be determined by applying the Z-transformation to the above difference equation (with 푦[0] = 0) as, 푧푌(z) = 푌(z) + ℎ{퐹(z) − 0.223푌(z)} or (푧 − 1 + 0.223ℎ)푌(z) = ℎ퐹(z) or 푌(z) ℎ 퐻(z) = = 퐹(z) 푧 − (1 − 0.223ℎ) The system is stable since the natural frequency (pole) 훾 = 1 − 0.223ℎ satisfies |훾| < 1 (recall that ℎ is positive and typically small). The impulse response of the system is given by ℎ ℎ[푘] = 푍−1 { } = ℎ[1 − 0.223ℎ]푘−1푢[푘 − 1] 푧 − (1 − 0.223ℎ) ℎ = [1 − 0.223ℎ]푘푢[푘] for 푘 > 0 1 − 0.223ℎ We intend to make ℎ[푘] approximate the impulse response, ℎ(푡), of the analog filter, where ℎ(푡) is given by

1 ℎ(푡) = 퐿−1 { } = 푒−0.223푡푢(푡) 푠+0.223

Next, we equate ℎ[푘] to the sampled version of ℎ(푡), namely ℎ(푘푇푠). This leads to the equation ℎ [1 − 0.223ℎ]푘 = 푒−0.223푘푇푠 = (푒−0.223푇푠 )푘 1 − 0.223ℎ

By matching coefficients we obtain the equations

ℎ = 1 and 1 − 0.223ℎ = 푒−0.223푇푠 1−0.223ℎ which leads to the solution ℎ ≅ 0.818 and 푇푠 ≅ 0.9. Using those values we obtain the (normalized) frequency response function for the digital filter

(with Ω = 푇푠ω = 0.9휔)

ℎ 0.818 퐻(Ω) = = 푧 − (1 − 0.223ℎ) 푒푗Ω − 0.818

Because of its periodicity, 퐻(Ω) need only be plotted over the interval Ω ∈ [0 휋]. The following is a Mathcad generated plot comparing the spectra of the denormalized frequency response

0.818 휋 퐻(휔) = , 휔 ∈ [0 ] 푒푗0.9ω − 0.818 0.9 to that of the analog filter’s frequency response 1 퐻(휔) = 0.223 + 푗휔

The following are the Mathcad generated plots.

Why doesn’t the frequency response of the LTID system match exactly that of the LTIC system? The answer (partly) has to do with the sampling rate used. The effective bandwidth of the band-unlimited signal 푒−푎푡푢(푡) was computed in Lecture 18 for the case 푎 = 1. Page 276 of Lathi’s text gives the effective bandwidth for this signal as, 퐵 = 2.02푎 Hz. Therefore, the effective bandwidth of 푒−0.223푡푢(푡) is 퐵 = 2.02(0.223) = 0.45 Hz. 1 1 So, we should sample at 푇 significantly below = = 1.11sec. But, 푠 2퐵 0.9 recall that in our designed digital filter, the sampling rate was 0.9 sec. So,

we should expect our discrete-time filter to become more accurate as we increase the sampling rate (i.e., as we reduce 푇푠). The recursion formula for our low-pass discrete-time filter can be determined from the transfer function, 푌(푧) 0.818 퐻(푧) = = 퐹(푧) 푧 − 0.818 or the corresponding equation 푧푌(푧) − 0.818푌(푧) = 0.818퐹(푧) by applying the inverse Z-transform to obtain, 푦[푘 + 1] − 0.818푦[푘] = 0.818푓[푘] or, in recursion form 푦[푘 + 1] = 0.818푦[푘] + 0.818푓[푘] The following simulation compares the (zero-state) response of the analog 휋 filter to the designed discrete-time filter for 푓(푡) = cos ( 푡) + cos(휋푡). 8 Here, the input signal is sampled with 푡 replaced by 푇푠푘, where 푇푠 = 0.9 to obtain 휋 푓[푘] = cos ( (0.9)푘) + cos(휋(0.9)푘) 8 The response of the digital filter (blue trace) is determined numerically through recursion. Note how the low-pass filter has suppressed the higher frequency at 휔 = 휋. A close inspection of the response reveals an initial transient period followed by a steady-state response. (The red trace represents the analog filter output.

The (artificially) aligned filter responses are shown below.

Impulse-invariance (direct) poles mapping method In the above impulse-invariance method, a digital filter was designed by sampling the impulse response of an analog filter, according to

ℎ[푘] = ℎ푎(푘푇푠) which suggests that, for the case of simple poles (i.e., natural frequencies,

푠푖), the sum of the natural modes of the digital filter is equal to the sum of the natural modes of the analog filter (note: 푢[푘푇푠] = 푢[푘]),

푘 푠푖푇푠푘 푠푖푇푠 푘 ∑ 퐴푖 훾푖 푢[푘] = ∑ 퐴푖 푒 푢[푘푇푠] = ∑ 퐴푖 (푒 ) 푢[푘] 푖 푖 푖 By matching coefficients in the above equation we obtain the digital filter’s 푠푖푇푠 poles in terms of the analog filter’s poles as, 훾푖 = 푒 . The Z-transform of the impulse response ℎ[푘] is then given by

퐴푖푧 퐴푖 푠푖푇푠 푘 ℎ[푘] = ∑ 퐴푖 (푒 ) 푢[푘] ↔ 퐻(푧) = ∑ = ∑ 푧 − 푒푠푖푇푠 1 − 푒푠푖푇푠푧−1 푖 푖 푖 The above result establishes the following direct mapping of the analog filter’s transfer function into that of the digital filter,

퐴푖 퐴푖 퐻(푠) = ∑ → 퐻(푧) = ∑ 푠 푇 −1 푠 − 푠푖 1 − 푒 푖 푠푧 푖 푖 퐴 The frequency response function is then 퐻(Ω) = ∑ 푖 푖 1−푒푠푖푇푠푒−푗Ω

It should be noted that if the analog filter is stable (휎푖 = Re(푠푖) < 0, ∀푖) then the digital filter obtained is also stable, since (note: 푠푖 = 휎푖 + 푗휔푖 and 푇푠 > 0):

푠푖푇푠 휎푖푇푠+푗휔푖푇푠 휎푖푇푠 푗휔푖푇푠 휎푖푇푠 |훾푖| = |푒 | = |푒 | = |푒 푒 | = 푒 < 1

For the case 퐻(푠) = 1 or ℎ(푡) = 훿(푡) the sampled signal leads to ℎ[푘] = 1 1 ℎ(푘푇푠) = 훿[푘] or a digital filter 퐻(푧) = = 푓푠. Also, it should be noted 푇푠 푇푠 that the resulting digital filter magnitude response |퐻(Ω)| can have a different dc gain, |퐻(0)|, compared to that of the analog filter. We typically would normalize such gain to unity.

퐴푖 In the case of a double pole, (푠) = 2 , the impulse response is ℎ푎(푡) = (푠−푠푖) 푠푖푡 퐴푖푡푒 푢(푡). Sampling ℎ푎(푡) with 푇푠, we obtain

푠푖푇푠푘 푠푖푇푠 푘 ℎ[푘] = ℎ푎(푘푇푠) = 퐴푖푘푇푠푒 푢[푇푠푘] = 퐴푖푘푇푠(푒 ) 푢[푘]

Using the transform pair, 훾푧 훾푧−1 푘훾푘푢[푘] ↔ = (푧 − 훾)2 (1 − 훾푧−1)2 we may then obtain the following 푧-domain representation for the double pole transfer function

푠푖푇푠 −1 퐴푖푇푠푒 푧 푠푖푇푠 푘 ℎ[푘] = 퐴푖푘푇푠(푒 ) 푢[푘] ↔ 퐻(푧) = (1 − 푒푠푖푇푠푧−1)2 Therefore, for the case of double poles, we have established the following direct mapping of an analog filter’s transfer function into that of a digital filter

푠푖푇푠 −1 푠푖푇푠 −푗Ω 퐴푖 퐴푖푇푠푒 푧 퐴푖푇푠푒 푒 퐻(푠) = 2 → 퐻(푧) = 푠 푇 −1 2 and 퐻(Ω) = 푠 푇 −푗Ω 2 (푠 − 푠푖) (1 − 푒 푖 푠푧 ) (1 − 푒 푖 푠 푒 )

The following table lists the digital filter transfer function 퐻(푧) for different forms of the analog filter 퐻(푠) based on impulse-invariance mapping. (푇 = 푇푠) 퐻(푠) 퐻(푧)

In general, 퐻(푠) would have to be expanded as the sum of partial fraction first. The impulse-invariance mapping of the partial fractions is performed based on the above table. Finally, the 푧-domain partial fractions are combined to give the digital filter’s transfer function 퐻(푧). Example. Design a digital filter based on the following second-order low- pass analog filter. Assume 푇푠 = 1. 0.5162 퐻(푠) = 푠2 + 1.016푠 + 0.5162 The poles are complex. So, we first express the denominator of 퐻(푠) in the 2 2 2 2 form (푠 + 푎) + 휔표 = (푠 + 0.5083) + 0.5078 so we may use the above table: 1.017(0.5078) 퐻(푠) = (푠 + 0.5083)2 + 0.50782 We may now employ the impulse-invariance mapping pair that is second to last in the above table, to obtain the digital filter: 1.017푒−0.5162 sin(0.5078) 푧 퐾푧 퐻(푧) = = 푧2 − 2푧푒−0.5162 cos(0.5078) + 푒−1.0165 푧2 − 1.051푧 + 0.362 The frequency response function of the digital filter is obtained by replacing 푧 by 푒푗Ω to obtain 퐾푒푗Ω 퐻(Ω) = 푒푗2Ω − 1.051푒푗Ω + 0.362 퐾 For |퐻(0)| = 1, we have to have = 1, or 퐾 = 0.311. 1−1.051+0.362

Alternatively, we can work in the time domain as follows:

First we obtain the unit-impulse response of the analog filter, ℎ(푡) = 퐿−1{퐻(푠)}, employing the table of Laplace transforms to obtain ℎ(푡) = 1.01푒−0.508푡 sin(0.508푡) 푢(푡) The impulse response of the digital filter obtained by sampling ℎ(푡) with

푇푠 = 1 is ℎ[푛] = 1.01푒−0.508푛 sin(0.508푛) 푢[푛]

By taking the corresponding z-transform and normalizing the gain at Ω = 0 to unity, we obtain 0.311푧 퐻(푧) = 푧2 − 1.051푧 + 0.362 The following figure compares the analog and digital filter magnitude responses.

It is curious to see the tail of |퐻(Ω)| (for higher frequencies) showing above that of |퐻푎(휔)| in the above plot. In the following, we show that this phenomena is due to .

In the impulse-invariance digital filter design method we assumed that

퐻(Ω) is obtained from 퐻푎(휔) through sampling the analog filter’s impulse response,

ℎ[푘] = ℎ푎(푘푇푠) According to the sampling theorem, the spectrum of the sampled signal

푓(푘푇푠) consists of the superposition of scaled and shifted versions of the Fourier transform 퐹(휔) according to ∞ 1 2휋 퐺(휔) = ∑ 퐹 (휔 − 푛) 푇푠 푇푠 푛=−∞ This result can be applied to the impulse-invariance design equation to give us the expression for the digital filter frequency response (recall that Ω =

휔푇푠), ∞ 1 퐻(Ω) = ∑ 퐻푎(Ω − 2휋푛) 푇푠 푛=−∞

Since 퐻푎(휔) is not generally bandlimited (think low-pass low order Butterworth filter), aliasing among various repeating cycles cannot be prevented, as depicted in the figure below.

If the analog filter is of high order, then we may think of its cutoff frequency 휔표 = 2휋푓표 as its effective bandwidth. In this case, the overlap 1 can be avoided if we select the sampling frequency as 푓푠 = > 2푓표 = 푇푠 휔 2 ( 표). Therefore, aliasing will be reduced greatly if we make the selection 2휋 휋 푇푠 < . 휔표

Your turn: Apply the impulse-invariance method to obtain a digital filter from the following analog filter. Compare the plots for |퐻(Ω)| and |퐻(휔)| after the normalizations |퐻(Ω)| = 1 and |퐻(휔)| = 1 at zero frequency.

1 (a) 퐻(푠) = (assume 푇 = 0.9) 푠+0.223 푠 1 (b) 퐻(푠) = (assume 푇 = 1) 푠2+3푠+2 푠 1 (c) 퐻(푠) = (assume 푇 = 0.5) (푠+1)2(푠+2) 푠

1 (푒−1−푒−2)푧−1 Ans. (a) 퐻(z) = (b) 퐻(z) = 1−0.818푧−1 (1−푒−1푧−1)(1−푒−2푧−1)

Your turn: Design an analog low-pass Butterworth filter to meet the following specifications. |퐻(휔)| = 0.9 for 휔 = 0.2휋 and |퐻(휔)| = 0.2 for 휔 = 0.3휋 Then employ the impulse-invariance method to obtain the corresponding digital filter (assume 푇푠 = 1 and normalize such that 퐻(Ω) = 1 at Ω = 0). Plot the spectra for the digital filter’s frequency response function, 퐻(Ω).

The Bilinear Transformation The bilinear transformation is a method that converts an 푠-domain transfer function into a 푧-domain transfer function that approximates the behavior of the continuous-time system. The method is based on a complex variable transformation that applies to the analog filter transfer function:

( ) | 2 푧−1 퐻 푧 = 퐻(푠) 푠 = 푇푠 푧+1 1 where the sampling period 푇푠 = is chosen as 푓푠 > 2퐵, 퐵 is the highest 푓푠 frequency present in the signal to be processed. It can be shown that the above transformation has the following properties:  The left half of the 푠-plane maps into the region inside the 푧-domain unit circle. This ensures the stability of the digital filter.  The right half of the 푠-plane maps into the region outside the 푧- domain unit circle.  The imaginary 푠-domain axis (푗휔) maps onto the 푧-domain unit circle. The mapping of the 푠-domain into the 푧-domain is depicted in the following figure.

The bilinear transformation was derived based on the trapezoidal integration rule in Lecture 20. In the following, we re-derive this important transformation based on the Pade rational function approximation method. In your numerical methods course you learned that rational function approximations are more accurate than Taylor series (polynomial) approximations. For very small 푇푠, the linear Taylor series approximation 푠푇푠 푠푇푠 of 푒 is given 푧 = 푒 ≅ 1 + 푠푇푠. An improved approximation is given 푎+푏푠 by the rational function 푧 = 푒푠푇푠 ≅ . The coefficients 푎, 푏, 푐 and 푑 can 푐+푑푠 now be determined as follows.

푠푇푠 푠푇 푠푇 푠푇푠 1 + 푠 푠 푒 2 2 + 푠푇푠 푧 = 푒푠푇푠 = 푒 2 푒 2 = ≅ = −푠푇 푠푇푠 푒 푠 1 − 2 − 푠푇푠 2 We may now solve (your turn) for 푠 as a function of 푧, and obtain the 2 푧−1 bilinear transformation, 푠 = . 푇푠 푧+1 It should be noted that the bilinear transformation transforms a stable rational transfer function 퐻(푠) into another stable rational function 퐻(푧). This is important: we can easily find the 푧-inverse of a rational function. The structure of the frequency response is preserved by the bilinear transformation, in the sense that the imaginary (푠 = 푗휔) axis maps onto 푧 = 푒푗Ω = 푒푗휔푇푠 unit circle. Here, the 푠-domain frequency range 휔 ∈ [−∞ ∞] maps (compactly) onto the finite 푧-domain frequency interval Ω ∈ [−휋 휋]. This nonlinear relationship (called warping) can be obtained 2 푧−1 by setting 푠 = 푗휔 and 푧 = 푒푗Ω in the transformation 푠 = to obtain 푇푠 푧+1 2 푒푗Ω−1 푗휔 = 푗Ω or, equivalently (employing Euler’s identity) 푇푠 푒 +1

푗Ω 푗Ω −푗Ω Ω 2 푒푗Ω − 1 2 푒 2 (푒 2 − 푒 2 ) 2 2푗sin ( ) 2 Ω 푗휔 = = = 2 = 푗 tan ( ) 푇 푒푗Ω + 1 푇 푗Ω 푗Ω −푗Ω 푇 Ω 푇 2 푠 푠 2 2 2 푠 2cos ( ) 푠 푒 (푒 + 푒 ) 2

2 Ω or, 휔푎 = tan ( ). For high sampling rates 푓푠 (or, equivalently, very 푇푠 2 Ω Ω small 푇 , such that Ω = 푇 휔 < 1) tan ( ) ≅ , and we obtain 푠 푠 2 2 3 2 Ω 2 푇푠휔푑 2 푇푠휔푑 푇푠휔푑 휔푎 = tan ( ) = tan ( ) ≅ ( − ( ) ) ≅ 휔푑 푇푠 2 푇푠 2 푇푠 2 2 and there is no shift in frequencies between the analog and digital filter response (recall that the Taylor series of the tangent function at the origin 푥3 is tan(푥) = 푥 − + ⋯ ). However, for lower sampling rates the analog 2 filter’s cutoff frequencies must be pre-warped before the design of the corresponding digital filter. Typically, we warp at the cutoff frequency.

This warping of the cutoff frequency 휔푐 guarantees that the digital cutoff frequency Ω푐 is at the correct position. The process is illustrated in the following example. Example. Determine a digital filter approximation of a first-order analog low-pass Butterworth filter using the bilinear transformation. Assume that the cutoff frequency of the digital filter is 푓푐 = 500 Hz (or 휔푐 = 1000휋) , and that the sampling frequency is 푓푠 = 4 kHz (or, 푇푠 = 0.25 msec). The normalized cutoff frequency of the digital filter, in radians/sample, is 휔푐 1000휋 휋 given by Ω푐 = 휔푐푇푠 = = = < 1. Therefore, we could proceed 푓푠 4000 4 with the design without pre-warping. However, for the sake of illustration we will apply pre-warping to the analog filter at the cutoff frequency. So,

′ we determine the analog filter’s warped cutoff frequency, 휔푐, by applying 휋 the warping equation to Ω = , 푐 4

′ 2 Ω푐 2 휋 2 휔푐 = tan ( ) = tan ( ) ≅ (0.414) = 3,314 푇푠 2 푇푠 8 푇푠 Therefore, the pre-warped first-order analog low-pass (Butterworth) approximation for this case is,

′ 1 1 퐻 (푠) = 푠 = 1 ′ + 1 푠 + 1 휔푐 3314 The application of the bilinear transformation results in 0.414 푧 + 1 ( ) | 2 푧−1 퐻 푧 = 퐻′(푠) 푠= = 푧−1 = 0.293 푇푠 푧+1 + 0.414 푧 − 0.414 푧+1 The following is a verification employing Matlab’s built-in bilinear function as illustrated in the following session, where Matlab returns the coefficients of the digital filter

푏1푧 + 푏2 퐻푑(푧) = 푎1푧 + 푎2

The normalized digital filter frequency response is 푒푗Ω + 1 퐻(Ω) = 0.293 푒푗Ω − 0.414 which upon substituting Ω = 푇푠휔 leads to the digital filter frequency response (푇푠 = 0.25 msec)

푒푗푇푠ω + 1 퐻푑(ω) = 0.293 푒푗푇푠ω − 0.414 The analog filter’s frequency response is, 1 1 1 1000휋 퐻 (휔) = | = = = 푎 휔 휔 휔 푠 + 1 푠=푗 푗 + 1 푗 + 1 푗휔 + 1000휋 휔푐 휔푐 1000휋 The following plots compare the frequency response (for 휔 > 0) of both filters.

It is interesting (and surprising) to note that the resulting digital filter has a better frequency response characteristics than the analog filter that it was derived from. This property is due to the nonlinear warping transformation that compresses the 푗휔 axis and maps it onto the perimeter of the unit circle.

The effect of warping in the design of the preceding digital filter are depicted in the following figure, where the sampling frequency is set to 휋 푓 = 2000 Hz (or, 푇 = 0.5 msec) leading to 휔 푇 = > 1. 푠 푠 푐 푠 2

The recursion formula (needed for computer implementation) for the just designed low-pass digital filter can be determined from the transfer function (back to assuming 푇푠 = 0.25 msec), 푌(푧) 푧 + 1 퐻(푧) = = 0.293 퐹(푧) 푧 − 0.414 or the corresponding equation 푧푌(푧) − 0.414푌(푧) = 0.293(푧퐹(푧) + 퐹(푧)) by applying the inverse Z-transform to obtain (here, we assume 푦[0] = 0) 푦[푘 + 1] − 0.414푦[푘] = 0.293(푓[푘 + 1] + 푓[푘]) or, in recursion form 푦[푘 + 1] = 0.414푦[푘] + 0.293푓[푘 + 1] + 0.293푓[푘]

Your turn: Employ the bilinear transformation to design a digital filter with sampling frequency 푓푠 = 8 kHz and cutoff frequency of 푓푐 = 1.6 kHz. Base your design on a second-order low-pass Butterworth filter whose 1 transfer function is given by 퐻(푠) = . Determine the digital 푠2+√2푠+1 filter’s poles and zeros. Determine the filter’s recursion formula. Compare the frequency response (magnitude and angle) of both filters. Your plots should look like the following plots.

Your turn: Consider the second-order analog filter (assume 푎, 푏 < 0 and real) 1 1 퐻(푠) = + 푠 − 푎 푠 − 푏 (a) Determine the poles and zeros of 퐻(푧) if the filter is designed using

the bilinear transformation with 푇푠 = 2. (b) Repeat Part (a) using the impulse invariance method, again with

푇푠 = 2. 1 Ans. (b) For 푇 = 2: 푧 = 푒2푎, 푧 = 푒2푏 and one zero at (푒2푎 + 푒2푏) 푠 1 2 2 Example: You are asked to design a digital filter based on a low-pass analog filter. Assume that the analog filter is a low-pass Butterworth filter with the following specifications: (1) passband edge attenuation of 1dB (or smaller) at 휔1 = 0.2휋, (2) stopband edge attenuation of 15 dB (or greater) at 휔2 = 0.3휋, and (3) attenuation of 0 dB at 휔 = 0. Employ the bilinear transformation to design the digital filter. Assume a sampling period 푇 = 1 sec. Determine the digital filter’s poles and zeros. Plot the frequency response (magnitude and angle) for the digital filter. Solution: Step 1: determine the Butterworth filter order 푛 and cutoff frequency 휔푐, from the given specifications, using the design equation 1 |퐻(휔푖)| = , 푖 = 1,2 휔 2푛 √1 + ( 푖) 휔푐 It is important to pre-warp the passband and stopband edge frequencies 휔1 and 휔2 in the above equation using the warped values, 휔 휔 = 2 tan ( 1,2). 푎1,2 2

Step 2. Establish the analog filter transfer 퐻(푠) with order 푛 and cutoff frequency determined in Step 1. Step 3. Apply the bilinear transformation through the substitution 푠 = 2 1−푧−1 to obtain the digital filter’s transfer function 퐻(푧). 푇 1+푧−1

Step 1: Keeping in mind that if a filter attenuates 퐴 dB (i.e., has a gain of −퐴 dB) at frequency 휔표 it means that 20 log10 |퐻(휔표)| = −퐴 or −퐴 ( ) |퐻(휔표)| = 10 20 . Therefore, the specifications can be interpreted as the −0 1 ( ) (− ) ( ) gains: |퐻(0)| = 10 20 = 1, |퐻(0.2휋)| ≤ 10 20 = 10 −0.05 ≅ 0.891 −15 ( ) ( ) and |퐻(0.3휋)| ≥ 10 20 = 10 −0.75 ≅ 0.178. In order to meet the design specifications for the analog low-pass Butterworth filter, we must solve the following system of two equation (pre-warping is applied and equalities are used): 1 ≅ 0.891 (1) 2 tan(0.1휋) 2푛 √1 + ( ) 휔푐 1 ≅ 0.178 (2) 2tan (0.15휋) 2푛 √1 + ( ) 휔푐 Solving the equations for 푛 (your turn) gives 푛 = 5.304. Since the order of the filter must be an integer, we round (up) to the nearest integer to get

푛 = 6. Substituting 푛 = 6 in Eq. (1) and solving gives 휔푐 = 0.72729. Repeating with the second equation we obtain 휔푐 = 0.76623. Which value do we choose? We will choose 휔푐 = 0.76623 because it has higher gain at the passband corner frequency 휔1 = 0.2휋, as is seen by the evaluation of 1 the gain: ≅ 0.937 > 0.891. 2 tan(0.1휋) 2푛 √1+( ) 0.76623

Step 2: utilizing the Table of Butterworth transfer function denominator coefficients (from Lecture 19) for a filter order 푛 = 6, we can then express the analog filter transfer function as 1 퐻(푠) = 푠 6 푠 5 푠 4 푠 3 푠 2 푠 1 ( ) + 3.87 ( ) + 7.46 ( ) + 9.41 ( ) + 7.46 ( ) + 3.87 ( ) + 1 휔푐 휔푐 휔푐 휔푐 휔푐 휔푐

Step 3: finally, we apply the bilinear transformation (and set 휔푐 = 0.76623) to obtain (your turn):

(푧 + 1)6 퐻(푧) = 퐻(푠)| 2 1−푧−1 = 푠=( ) 6 5 4 3 2 1 1+푧−1 1,360푧 − 4230푧 + 6270푧 − 5120푧 + 2450푧 − 647푧 + 72.9 Notice that the six zeros at infinity of 퐻(푠) are mapped to six zeros at 푧 = 1 for the digital filter. Also, the digital filter is stable since its six poles are inside the unit-circle:

The frequency response plots for the digital filter are shown below where

퐻 푧 | 푗Ω . 퐻(Ω) = ( ) 푧=푒

Frequency Domain-Based LTID Filter Design Instead of basing the design of the digital filter on an approximation or mapping of an analog filter, we will show how the design can be performed by directly placing the poles and zeros of the frequency response 퐻(Ω). We start with a (stable) discrete-time system with transfer function 퐻(푧), 퐾(푧 − 푧 )(푧 − 푧 ) … (푧 − 푧 ) 퐻(푧) = 1 2 푚 (푧 − 훾1)(푧 − 훾2) … (푧 − 훾푛)

푗Ω with 푚 zeros (푧푖) and 푛 poles (훾푙). 퐾 is a gain constant. Replacing 푧 by 푒 results in the digital filter’s frequency response

푗Ω 푗Ω 푗Ω 푗Ω 퐾(푒 − 푧1)(푒 − 푧2) … (푒 − 푧푖) … (푒 − 푧푚) 퐻(Ω) = 푗Ω 푗Ω 푗Ω 푗Ω (푒 − 훾1)(푒 − 훾2) … (푒 − 훾푙) … (푒 − 훾푛)

The setting 푧 = 푒푗Ω restricts the complex variable to the edge of the unit- circle in the complex frequency plane, as depicted in the following figure. This is analogous to setting 푠 = 푗휔 in 퐻(푠) to arrive at the analog filter’s frequency response function 퐻(휔), that restricts the complex variable to the 푗휔 axis.

Next, we can customize the frequency response through the proper 푗Ω푖 placement of zeros on the unit-circle (푧푖 = 푒 ) and placement of poles within the unit circle. For stability, we require all poles 푧푙 to satisfy 푗Ω푙 |훾푙푒 | < 1 or, equivalently, |훾푙| < 1. In addition, and in order for the realization to result in a real system, we would require that all complex poles and zeros to occur as complex conjugate pairs.

Low-Pass Filter The following figure depicts the placement of two poles and two zeros (the pole and zero angles are listed in degrees: 600 ≅ 1.047 rad and 139표 ≅ 2.426 rad, respectively.) Such pole/zero placement

results in the following second-order low-pass filter frequency response, (푒푗Ω − 푒푗2.426)(푒푗Ω − 푒−푗2.426) 퐻(Ω) = (푒푗Ω − 0.5푒푗1.047)(푒푗Ω − 0.5푒−푗1.047)

푙 푙 Note that |퐻(Ω)| = 1 2 , the product of the respective distances between 푑1푑2 the zeros and the point 푒푗Ω divided by the product of the respective distances of the poles from the point 푒푗Ω. The magnitude spectrum is plotted below (your turn: generate the plot using Mathcad).

Similarly, proper placement of poles and zeros will lead to other types of filters, as is illustrated next. Mini Project: (Consult with your instructor) Write a Matlab (or C++) program that allows the user to point-and-click to palce any number of filter zeros the unit circle and poles inside the unit circle. The function should allow the user to use the mouse to drag the point 푒푗Ω on the unit circle, should animate the line segments (distances) to the pole and to the zeros, and should construct (plot) the filter’s magnitude and angle spectra. Your turn: Study the following sequence of plots, generate their corresponding 퐻(Ω) and use Mathcad to plot the magnitude and phase spectra for Ω ∈ [0 휋]. Remember to express the angles in radians in the expression for 퐻(Ω) before generating the plots. The magnitude plots that you need to generate are given to you, so that you may verify your results.

High-Pass Filter

Band-Pass Filter

푗휋 ± Note: ±푗0.95 = 0.95푒 2

Band-Reject Filter

Notch-Filter Design

In order to remove a frequency at Ω푟, the filter’s transfer function 퐻(푧) should have zeros at 푒±푗Ω푟. Furthermore, in order to minimize the impact of those zeros on frequencies different from Ω푟 (and −Ω푟), the transfer fuction must have poles at 푎푒±푗Ω푟 located very close to the zeros (푎 must be slightly smaller than 1, so as to assure stability). The effect of the closely placed pole and zero cancel out for input frequencies Ω that are not close to Ω푟. Therefore, a second-order discrete-time linear notch filter that rejects the frequency Ω푟 should have the transfer funcion,

푗Ω푟 −푗Ω푟 2 (푧 − 푒 )(푧 − 푒 ) 푧 − 2푧 cos(Ω푟) + 1 퐻(z) = 푗Ω −푗Ω = 2 2 (푧 − 푎푒 푟)(푧 − 푎푒 푟) 푧 − 2푎푧 cos(Ω푟) + 푎

Example. Design (by direct pole/zero placement) and simulate (using Mathcad) a digital notch filter that rejects the 400휋 rad/sec frequency. Test your filter on the input signal 푓(푡) = sin(250휋푡)푢(푡) + sin(400휋푡)푢(푡).

Assume a sampling rate 푓푆 =1000 samples per second. 1 Solution: At 푓푠 = 1000 samples/sec, 푇푠 = = 0.001 and the normalized 푓푠 radian frequency of the sinusoid to be rejected is Ω푟 = ω푟푇푠 = 400π(0.001) = 0.4휋. Let us set 푎 = 0.9.

The transfer function for this notch filter is then given by 푧2 − 2푧 cos(0.4휋) + 1 푧2 − 0.62푧 + 1 퐻(푧) = = 푧2 − 1.8푧 cos(0.4휋) + 0.92 푧2 − 0.56푧 + 0.81 or, equivalently, 1 − 0.62푧−1 + 푧−2 퐻(푧) = 1 − 0.56푧−1 + 0.81푧−2

Writing the transfer function as 푌(푧)/퐹(푧) and cross multiplying gives

(1 − 0.56푧−1 + 0.81푧−2 )푌(푧) = (1 − 0.62푧−1 + 푧−2)퐹(푧)

Applying the inverse Z-tarnsform (with 푦[−1] = 푦[−2] = 0) and rearranging, results in the recursion

푦[푘] = 0.56푦[푘 − 1] − 0.81푦[푘 − 2] + 푓[푘] − 0.62푓[푘 − 1] + 푓[푘 − 2]

The (causal) sampled input signal is expressed as,

푓[푘] = sin(250휋푇푠푘)푢[푘] + sin(400휋푇푠푘)푢[푘] = sin(0.25휋푘)푢[푘] + sin(0.4휋푘)푢[푘] with 푓[−2] = 푓[−1] = 0.

Before we simulate the system, let us try to determine the steady-state response of the system from employing the formula

푦푠푠[푘] = |퐻(Ω1)| sin[Ω1푘 + ∠퐻(Ω1)] + |퐻(Ω2)| sin[Ω2푘 + ∠퐻(Ω2)] where 퐻(Ω) is the frequency response obtained from 퐻(푧) by setting 푧 = 푒푗Ω, 푒푗2Ω − 0.62푒푗Ω + 1 퐻(Ω) = 푒푗2Ω − 0.56푒푗Ω + 0.81

The following plots confirm the desired behavior of our filter.

Next, we compute (using Mathcad) |퐻(0.25휋)|, |퐻(0.4휋)|, ∠퐻(0.25휋) and ∠퐻(0.4휋) [Recall that Mathcad’s arg() returns the angle] and obtain

Therefore, the steady-state response is

푦푠푠[푘] ≅ 1.085 sin(0.25휋푘 − 0.185)

Finally, we simulate the digital filter to find the zero-state response by using the just derived recursion

푦[푘] = 0.56푦[푘 − 1] − 0.81푦[푘 − 2] + 푓[푘] − 0.62푓[푘 − 1] + 푓[푘 − 2] with 푓[푘] = sin(0.25휋푘)푢[푘] + sin(0.4휋푘)푢[푘] and 푦[−2] = 푦[−1] = 푓[−2] = 푓[−1] = 0.

The following Mathcad worksheet compares the steady-state response (red) of the notch filter to the zero-state response (blue).

Your turn: Design a discrete-time notch filter

퐾(푒푗Ω − 푒푗Ω푟)(푒푗Ω − 푒−푗Ω푟) 퐻(Ω) = (푒푗Ω − 푎푒푗Ω푟)(푒푗Ω − 푎푒−푗Ω푟) with the following specifications. Plot the magnitude response and confirm the notch nature of your filter. Also, determine the filter’s difference equation.

 It rejects the 1000 Hz harmonic.  Its magnitude response is 0.9 at 900Hz.  Its dc gain is 1.

 Assume a sampling frequency 푓푠 = 6000 samples/sec.

Verify your design by plotting |퐻(Ω)|.

2 2 퐾(푧 −2푧 cos(Ω푟)+1) 0.9525(푧 −푧+1) Ans. 퐻(푧) = 2 2 = 2 푧 −2푎푧 cos(Ω푟)+푎 푧 −0.95푧+0.9025

Simulink Example of a Notch Filter http://www.mathworks.com/help/dsp/examples/removing-an-interfering-tone-from-a-streaming-audio-signal.html

A notch filter is used to eliminate a specific harmonic from a given signal. In their most common form, the design specifications for notch filters are center (notch) frequency (Ω푟) and the 3 dB bandwidth. The center frequency is the frequency point at which the filter has a gain of zero. The 3 dB bandwidth measures the frequency width of the notch of the filter computed at the half-power or 3 dB attenuation point. In this example, you tune a digital notch filter in order to eliminate a 250 Hz sinusoidal tone that is corrupting an audio signal. You can control both the center frequency and the bandwidth of the notch filter and listen to the filtered audio signal as you tune the filter. We have demonstrated this filter in Lecture 19 in connection with analog notch filters. In fact, the filter used then was (obviously) a digital filter, not analog.

The command audioToneRemovalExampleApp launches a user interface designed to interact with the simulation. It also launches a spectrum analyzer to view the spectrum of the audio with and without filtering, along with the magnitude response of the notch filter.

Your turn: Consider the LTID system with the transfer function 푧5 + 2.414푧4 + 3.414푧3 + 3.414푧2 + 2.414푧 + 1 퐻(푧) = 푧5 − 1.73푧4 + 1.96푧3 − 1.49푧2 + 0.84푧 − 0.25 Determine the frequency response 퐻(Ω) and plot its spectra [Hint: Factor the polynomials and substitute 푒푗Ω for 푧]. Also, determine the filter’s recursion formula and find the response 푦[푘] (using Mathcad) for a unit impulse 훿[푘]. Repeat for the everlasting input, 휋 휋 푓(푡) = cos ( 푡) + sin ( 푡) 8 2 Assume a sampling rate of 1 samples/sec. Identify the filter type and justify the answer you obtained for 푦[푘]. Ans. (for first part)

푗휋 푗휋 푗3휋 푗3휋 − − (푒푗Ω − 푒 2 ) (푒푗Ω − 푒 2 ) (푒푗Ω − 푒 4 ) (푒푗Ω − 푒 4 ) (푒푗Ω − 푒푗휋)

퐻(Ω) = 푗휋 푗휋 푗휋 푗휋 − − (푒푗Ω − 0.6) (푒푗Ω − 0.8푒 4 ) (푒푗Ω − 0.8푒 4 ) (푒푗Ω − 0.8푒 2 ) (푒푗Ω − 0.8푒 2 )

Note: Matlab has a convenient tool called fvtool that allows the user to input the numerator and denominator coefficient vectors of 퐻(푧) and obtain the spectra (magnitude and phase), step-response, impulse-response, pole-zero plot among other things. The following is an application of this tool for the above “your turn” problem. Give it a try.

Simulink Demonstrations: (Hyperlinked to instructor’s laptop. File is available in the online folder associated with this lectures)

 The effect of a low-pass digital filter on a speech signal:

SpeechHighPassTunableExample.slx

 The effect of a high-pass digital filter on a speech signal:

SpeechLowPassTunableExample.slx

Matlab’s Digital Filter Design Tool: fdatool

Typing fdatool at the Matlab prompt opens the Digital Filter Design and Analysis Tool. The interface should look like the one shown in the figure below.

The following is a Low-pass Elliptic filter designed with the following specifications: passband frequency of 9.6 kHz and stopband frequency of 12 kHz. The passband ripple is 1dB; it corresponds to a gain ripple 휀, 1 where 20 log(휀) = 1, or 휀 = 1020 = 1.122. Which means that the passband gain fluctuates between ±1.122 of the gain at zero. The stopband

attenuation is below −80 dB (or output signal amplitude is less than 0.0001 times the input signal amplitude). The filter is designed to work with audio signals that are sampled with sampling frequency 푓푠 = 44.1 kHz.

The filter can be stored (and named) for future reference if you click on the “Store Filter” button. The fdatool allows the user to compute various filter properties including the frequency response and pole-zero plot. The following is the phase and pole-zero plots for the designed filter. Note that the design specifications required an order 8 filter.

Finally, we may realize and save the model for future use as a Simulink block:

As another example, let us reconsider an earlier “your turn” problem. Here is the problem statement: Design a discrete-time filter with sampling frequency 푓푠 = 8 kHz and cutoff frequency of 푓푐 = 1.6 kHz based on a second-order Butterworth filter whose transfer function is given by 퐻(푠) = 1 . Compute the digital filter coefficients and the poles and zeros. 푠2+√2푠+1 Compare the frequency response (magnitude and angle) of both filters. The FDA Tool can be used to solve this problem if we begin by specifying a second-order IIR Butterworth filter with 푓푠 = 8 kHz and 푓푐 = 1.6 kHz as shown in the following figure. In fact, the bilinear transformation (introduced earlier) is used to generate the digital filter.

Clicking on “Design Filter” located at the bottom (center) of the user interface generates the filter. The “Filter Visualization Tool” can now be executed by selecting the last link in the “view” drop-down menu. The following plots and results were generated using the visualization tool (note that the frequency axis is in kHz).

The “Pole/Zero Editor” (which can be accessed from the lower left- hand side fdatool menu) allows the user to automatically view the frequency response of the filter as the poles/zeros are inserted, removed and/or are moved around. Watch movie.

Example. Generate a signal consisting of the sum of three sampled (푓푠 = 44100 Hz) sinusoids oscillating at frequencies 1100 Hz, 1200 Hz and 1300 Hz, respectively. Design a digital bandpass filter that only passes the 1200 Hz sinusoid. The signal can be generated using Simulink as shown below along with the frequency spectrum of the signal.

We will choose an infinite impulse response (IIR) digital filter with a passband [1175 1225] and stopbands [0 1150] and [1250 22050] designed using Chebyshev Type 1 method. Note: Since Ω = 휔푇푠 = 2휋푓/푓푠 and since Ω is periodic with maximum value of 휋, then the highest 푓 44100 relevant frequency for this filter would be 푓 = 푠 = = 22,050Hz. 푚푎푥 2 2 This frequency is indicated as 푓푠/2 in the following figure.

The resulting filter has order 18 and its frequency response and pole-zero plot are shown below.

The Simulink block diagram is shown below.

The filter’s input and output signal spectra are shown in the following plots. As you can see, the 1200 Hz sinusoid was successfully passed while the other two boardering frequensies were blocked.

Instructor: Execute the fllowing Simulink files to listen to the unfiltered and to the filtered signal:

sine_waves_No_FilterExample.slx sine_waves_Bandpass_FilterExample.slx

Your turn: Repeat the above Simulink simulation (generate all figures and plots) such that only the 1200 Hz sinusoid is blocked.

Demonstrations:  Chirp processing with a digital filter

chirp_digital_filter_design_speaker_demo.slx

 Real-time speech processing with a digital filter

MicrophoneSpeechNotch_3000Hz.slx

Nonlinear LSE-Based Digital Filter Design

Consider a digital filter with the frequency response function

푗Ω −푗Ω 푗Ω −푗Ω 퐾(푒푗Ω − 푒 푧1 )(푒푗Ω − 푒 푧1 ) … (푒푗Ω − 푒 푧푚 )(푒푗Ω − 푒 푧푚 ) 퐻(Ω) = 푗Ω 푗Ω푝 푗Ω −푗Ω푝 푗Ω 푗Ω푝 푗Ω −푗Ω푝 (푒 − 푎1푒 1 )(푒 − 푎1푒 1 ) … (푒 − 푎푛푒 푛 )(푒 − 푎푛푒 푛 )

Having the 2푛 + 푚 + 1 parameters

퐾, 푎 , 푎 , … , 푎 , Ω , Ω … Ω , Ω , Ω … Ω 1 2 푛 푧1 푧2 푧푚 푝1 푝2 푝푛

Now, assume the following set of 푁 specifications on the magnitude of the frequency response of the filter at frequencies Ω푖

|퐻(Ω1)| = 퐴1, |퐻(Ω2)| = 퐴2, … |퐻(Ω푖)| = 퐴푖, … |퐻(Ω푁)| = 퐴푁

Typically, the number of constraints is greater than the number of parameters, 푁 ≥ 2푛 + 푚 + 1 (over-determined system of equations) and a perfect solution does not exist. Here, we may approximate the filter parameters by minimizing the sum-of-squared error (SSE) criterion (recall the LSE regression problem from your numerical methods course) 푁 퐼(퐾, 푎 , 푎 , … , 푎 , Ω , Ω … Ω , Ω , Ω … Ω ) = ∑(|퐻(Ω )| − 퐴 )2 1 2 푛 푧1 푧2 푧푚 푝1 푝2 푝푛 푖 푖 푖=1

This is a nonlinear optimization problem that can have multiple solutions (local minima) leading to solutions with varying degrees of accuracy. A solution (퐾∗, 푎∗, 푎∗, … , 푎∗ , Ω∗ , Ω∗ … Ω∗ , Ω∗ , Ω∗ … Ω∗ ) is referred to as 1 2 푛 푧1 푧2 푧푚 푝1 푝2 푝푛 the least-squares-error (LSE) solution. The LSE solution is a sort of a “compromise” solution that attempts to satisfy all constraints, as close as possible.

The SSE criterion 퐼 is a nonlinear function of its (regression) parameters. Therefore, special numerical optimization methods must be employed (such as Matlab’s fminsearch and Mathcad’s Minimize optimization functions). The problem can have multiple solutions (local minima). Care must be taken in choosing initial search parameters so that the underlying numerical algorithms converge to a proper design for the digital filter. By “proper design” we mean a design that locates the zeros on the complex unit-circle and locates the poles inside the unit-circle (for filter stability). The following example illustrates the LSE-based filter design method.

Example. Design the (normalized) second-order high-pass digital filter

퐾(푒푗Ω − 푒푗Ω푧)(푒푗Ω − 푒−푗Ω푧 ) 퐻(Ω) = (푒푗Ω − 푎푒푗Ω푝)(푒푗Ω−푎푒−푗Ω푝) according to the following specifications: 1. Its magnitude at Ω = 0 is 0 휋 1 2. Its magnitude at Ω = is . 4 10 3휋 2 3. Its magnitude at Ω = is √ . 4 2 7휋 9 4. Its magnitude at Ω = is . 8 10 5. Its magnitude at Ω = 휋 is 1.

Here, we need to solve for the zero Ω푧, pole Ω푝, gain constant 퐾 and the parameter 푎 (recall that 푎 represents the distance of the pole from the origin and must be less than 1). The SSE criterion is given by the function

퐼(퐾, 푎, Ω푧, Ω푝) 2 휋 2 3휋 √2 = (|퐻(0)| − 0)2 + (|퐻 ( )| − 0.1) + (|퐻 ( )| − ) 4 4 2 7휋 2 + (|퐻 ( )| − 0.9) + (|퐻(휋)| − 1)2 8

Note that you have to experiment with several initial search points and choose the physically feasible solution (poles inside the unit-circle, 푎 < 1) ∗ ∗ ∗ ∗ that gives the smallest value for 퐼. The solution (퐾 , 푎 , Ω푧, Ω푝) = (0.205, 0.585, 0.892, 2.15) achieves a value of 퐼 = 0.021 and locates the pole inside the unit-circle. The following is Mathcad’s solution employing the build-in optimization function Minimize.

∗ ∗ ∗ ∗ For the above Mathcad solution, (퐾 , 푎 , Ω푧, Ω푝) = (0.205, 0.585, 0.892, 2.15), we may express the frequency response as,

0.205(푒푗Ω − 푒푗0.892)(푒푗Ω − 푒−푗0.892) 퐻(Ω) = (푒푗Ω − 0.585푒푗2.15)(푒푗Ω−0.585푒−푗2.15) or, express the transfer function as,

0.205(푧 − 푒푗0.892)(푧 − 푒−푗0.892) 퐻(푧) = (푧 − 0.585푒푗2.15)(푧−0.585푒−푗2.15) 푧2 − 1.256푧 + 1 퐻(푧) = 0.205 푧2 + 0.64푧 + 0.342

Your turn: Locate the poles and zeros of the above frequency response in the complex plain (in relation to the unit circle). Also, determine the filter’s recursion formula.

The above optimization problem can also be solved using Matlab’s fminsearch function, as shown below. Notice that the search, for the ∗ ∗ ∗ ∗ indicated initial conditions, converged to the solution (퐾 , 푎 , Ω푧, Ω푝) = (0.149, 0.507, 1.004, 2.465) which is different from the Mathcad solution.

The following are the filter spectra.

Your turn: Locate the poles and zeros of the above frequency response on the unit-circle. Determine the filter’s recursion formula. Comment on the stability of the filter.

Your turn: Study the above Matlab code, then repeat the simulation with different initial conditions.

Your turn: Employ the LSE method in order to design a digital second- order low-pass filter with the following transfer function.

퐾(푒푗Ω − 푒푗Ω푧)(푒푗Ω − 푒−푗Ω푧 ) 퐻(Ω) = (푒푗Ω − 푎푒푗Ω푝)(푒푗Ω−푎푒−푗Ω푝) Plot the filter’s magnitude spectrum. Also, determine the transfer function 퐻(푧) and the filter’s difference equation. The filter should meet the following specifications: 1. Its magnitude at Ω = 0 is 1 휋 9 2. Its magnitude at Ω = is . 4 10 3휋 2 3. Its magnitude at Ω = is √ . 4 2 7휋 1 4. Its magnitude at Ω = is . 8 10 5. Its magnitude at Ω = 휋 is 0.

Numerical Methods as Recursive Filters: Error Analysis In Lecture 21 we had formulated the trapezoidal integration rule as a LTID system. The Z-transform method was then used to determine the zero-state response for a sinusoidal input signal. In this section, an efficient frequency-domain analysis method is applied to generate error formulas for the trapezoidal integration rule and Simpson’s 1/3 integration rule. These are the same error formulas that were derived in your numerical methods course, based on the Taylor series approximation analysis method. Assuming the (everlasting, generalized sinusoid) complex exponential 푗Ω표푘 signal 푓[푘] = cos(Ω표푘) + 푗 sin(Ω표푘) = 푒 [its DTFT is 퐹(Ω) = ∞ 2휋 ∑푛=−∞ 훿(Ω − Ω0 − 2휋푛)we may determine the zero-state response of a LTID systems [described by its frequency response 퐻(Ω)] as ∞ −1 푦[푘] = 퐹 {퐻(Ω) ∑ 2휋훿(Ω − Ω0 − 2휋푛)} 푛=−∞ ∞ −1 = 퐹 { ∑ 퐻(Ω0 + 2휋푛)2휋훿(Ω − Ω0 − 2휋푛)} 푛=−∞ which by using the periodicity 퐻(Ω0) = 퐻(Ω0 + 2휋푛) can be rewritten as ∞ −1 = 퐹 { ∑ 퐻(Ω0)2휋훿(Ω − Ω0 − 2휋푛)} 푛=−∞ ∞ −1 = 퐻(Ω0)퐹 { ∑ 2휋훿(Ω − Ω0 − 2휋푛)} 푛=−∞

푗Ω표푘 = 퐻(Ω0)푒 

In the above derivation, we have employed the sampling/sifting property of the unit-impulse function, the periodicity property and the frequency shift property of the DTFT. Therefore, a LTID system outputs the signal 푦[푘] which is a scaled version of the input signal, 푓[푘] = 푒푗Ω표푘, according to

푗Ω표푘 푦[푘] = 퐻(Ω0)푒

Because of this result, the generalized signal 푒푗Ω표푘 is referred to as eigen- function for all LTID systems. Trapezoidal integration rule Let us re-consider the trapezoidal integration formula ℎ 푦[푘 + 1] = 푦[푘] + {푓[푘 + 1] + 푓[푘]} 2 Transforming the above difference equation using the DTFT and rearranging terms leads to the frequency response 푌(Ω) ℎ 푒푗Ω + 1 퐻(Ω) = = ( ) 퐹(Ω) 2 푒푗Ω − 1 The filter (trapezoidal integration formula) response to the everlasting complex exponential, 푒푗Ω표푘, is then given by

ℎ 푒푗Ω표 + 1 푦[푘] = ( ) 푒푗Ω표푘 2 푒푗Ω표 − 1 (Note: The response to a purse cosine is equal to the real part of the above expression. Also, recall that Ω표 = ω표푇푠.)

Now, in the continuous-time domain, the true value of the integral of 푓(푡) = 푒푗ω표푡 is given by 1 푗ω표휏 푗ω표푡 푦푡푟푢푒(푡) = ∫ 푒 푑휏 = 푒 푗ω표 or, in sampled/discrete-time form 1 1 푗ω표푇푠푘 푗Ω표푘 푦푡푟푢푒[푘] = 푒 = 푒 푗ω표 푗ω표 We may then write the ratio 푦[푘] as 푦푡푟푢푒[푘]

푗Ω표 푦[푘] 푗ω표ℎ 푒 + 1 푅(Ω표) = = ( ) 푗Ω 푦푡푟푢푒[푘] 2 푒 표 − 1

1 1 − (푎2+푎 2) 푎+1 푗Ω표 which can be simplified using the identity = 1 1 (with 푎 = 푒 ) 푎−1 − (푎2−푎 2) and setting ℎ equal to 푇푠 (leading to, ω표ℎ = ω표푇푠 = Ω표) into

Ω표 푗Ω 2cos ( ) Ω 훺 ( ) 표 2 표 표 푅 Ω표 = ( ) Ω = cot ( ) 2 2푗 sin ( 표) 2 2 2 1 1 1 Employing the power series expansion, cot(푥) = − 푥 − 푥3 − ⋯, we 푥 3 45 may express 푅(Ω표) as (try it) Ω2 Ω4 푅(Ω ) = 1 − 표 − 표 − ⋯ 표 12 720 which, for small Ω표, can be approximated as 푦[푘] Ω2 ≅ 1 − 표 푦푡푟푢푒[푘] 12

From this last result, we may express the absolute relative error for the trapezoidal rule as

2 푦푡푟푢푒[푘] − 푦[푘] Ω표 1 2 2 | | = = ℎ 휔표 푦푡푟푢푒[푘] 12 12

This is the same result [exhibiting an 푂(ℎ2) convergence rate] that we obtained in Lecture 21 employing the Z-transform method for the case of a sinusoidal 푦[푘].

Simpson’s 1/3 integration rule Consider Simpson’s 1/3 iterative integration formula ℎ 푦[푘 + 1] = 푦[푘 − 1] + {푓[푘 + 1] + 4푓[푘] + 푓[푘 − 1]} 3 Applying the DTFT and manipulating leads to the frequency response ℎ 푒푗2Ω + 4푒푗Ω + 1 퐻(Ω) = ( ) 3 푒푗2Ω − 1

The response to the complex exponential 푒푗Ω표푘 signal is

ℎ 푒푗2Ω표 + 4푒푗Ω표 + 1 푦[푘] = ( ) 푒푗Ω표푘 3 푒푗2Ω표 − 1 which upon employing Euler’s identity reduces to (Your turn: Prove it)

ℎ 2 + cos(Ω표) 푦[푘] = ( ) 푒푗Ω표푘 3 푗sin(Ω표)

Setting ℎ = 푇푠, we can determine the ratio 푅(Ω표) as

푦[푘] Ω표 [2 + cos(Ω표)] 푅(Ω표) = = ( ) 푦푡푟푢푒[푘] 3 sin(Ω표)

The following plot compares 푅(Ω표) for the trapezoidal rule to that of Simpson’s 1/3 rule. Notice how Simpson’s rule provides a better approximation to the true value over a wider range of frequencies, Ω표. However, when the function has very high variations or noise (i.e., has high frequencies) Simpson’s 1/3 formula will fail unless the integration constant ℎ (i.e., sampling period, 푇푠) is made very small (recall that Ω표 = 휔표푇푠 = 휔표ℎ).

Your turn: Generate the above plot using Mathcad.

Your turn: Show that (employing power series expansion and long division) the ratio 푅(Ω표) for Simpson’s 1/3 rule can be expressed, for small Ω표, as

4 Ω표 [2 + cos(Ω표)] Ω표 푅(Ω표) = ( ) ≅ 1 − 3 sin(Ω표) 180 which leads to the absolute relative error,

4 푦푡푟푢푒[푘] − 푦[푘] Ω표 1 4 4 | | = |푅(Ω표) − 1| = = ℎ 휔표 푦푡푟푢푒[푘] 180 180

[Note the O(ℎ4) convergence rate for this method.]

Your turn: Determine the frequency response and plot 푅(Ω표) for Tick’s integration formula:

푦[푘 + 1] = 푦[푘 − 1] + ℎ{0.3584푓[푘 + 1] + 1.2832푓[푘] + 0.3584푓[푘 − 1]}

The following is a plot comparing 푅(Ω표) for various integration rules.

Your turn: Show (employing frequency-domain analysis) that the absolute relative error for the central difference differentiation formula ℎ 푦[푘] = {푓[푘 + 1] − 푓[푘 − 1]} 2 is given by

푦푡푟푢푒[푘] − 푦[푘] 1 2 2 | | ≅ ℎ 휔표 푦푡푟푢푒[푘] 6

Last “your turn”: a. Design an analog notch filter that eliminates the 250 Hz and 1000 Hz tones from an audio signal. Employ the frequency domain pole/zero placement method of Lecture 19 to design the filter. Plot the filter’s spectra. Validate your filter analytically by determining the steady-state response for the input signal 푓(푡) = [cos(500휋푡) + cos(600휋푡) + cos(2000휋푡)]푢(푡) Employ Mathcad simulations to arrive at the zero-state response of the filter. Provide a graph comparing the steady-state and zero-state responses. b. Design a digital filter employing the frequency domain pole/zero placement method covered in this lecture. Assume 푓푠 = 44,100 Hz. Determine the transfer function 퐻(푧) and the frequency response 퐻(Ω). Plot the filter’s frequency response spectra. Employ 퐻(Ω) to solve for the steady state- response, 푦푠푠[푘]. Determine the difference equation for the filter and employ it to solve (iteratively) for the zero-state response, 푦푧푠[푘], subject to the sampled

input, 푓(푇푠푘). Compare (by graphing) the sampled filter zero-state response to that of the analog filter. c. Design a digital filter (find 퐻(푧)) that you obtained from the analog filter of Part (a) using the impulse invariance method. Compare the frequency response |퐻(Ω)| for your digital filter to that in Part (b), by generating a single plot with 0 ≤ Ω ≤ 0.2. [Make sure you normalize the filters so that |퐻(Ω = 0)| = 1.] d. Implement the following Simulink system. The filter should utilize the coefficients of the transfer function from Part (b). Test the system with an audio signal from your smart phone (a song or a radio station broadcast). The sine wave blocks are used to generate the 250 and 1000 Hz distortion tones.

Microphone_digital_notch_filter_design_speaker_last_your_turn.slx Appendix: General Summary

Linear Time-Invariant (LTI) Systems

 Continuous-Time (CT) systems process CT signals.  Discrete-Time (DT) systems process DT signals.  푓(푡) represents a continuous-time signal.  푓[푘] represents a discrete-time signal (a sequence).  Bandwidth of 푓(푡) is 퐵 (Hz). B is determined utilizing the Fourier transform.

 Sampled signal: 푓(푡) → 푓[푘] = 푓(푇푠푘), with integer 푘. 1  Sampling Theorem: 푓 > 2퐵 (or 푇 < ) is required for perfect reconstruction of 푓(푡) from 푓[푘]. 푠 푠 2퐵  LTICT system dynamics are governed by a linear differential equation which relates the system response 푦(푡) to the input signal 푓(푡), subject to certain initial conditions.  LTIDT system dynamics are governed by a linear difference equation which relates the system response 푦[푘] to the input signal 푓[푘], subject to certain initial conditions.

 System analysis methods allow us to solve for 푦 = 푦푧푖 + 푦푧푠, where 푦푧푖 is the (zero-input) response due to the initial state/conditions (or initial energy stored in the system) and 푦푧푠 is the (zero-state) response due to the input 푓 (with stored energy set to zero).  System Transfer functions are rational functions (ratio of two polynomials) that are obtained using the Laplace transform for LTICT systems, and using the Z-transform for LTIDT systems. 푁(푠)  LTICT system transfer function: 퐻(푠) = [퐷(푠) is the characteristic equation of the system]. 퐷(푠)

 The solutions, 푠푖, of 퐷(푠) = 0 are the system poles or natural frequencies (generally complex valued). 푠푖푡  LTICT system natural modes take the form, 푒 . Stability requires 푅푒(푠푖) < 0 for all 푠푖. 푁(푧)  LTIDT system transfer function: 퐻(푧) = [퐷(푧) is the characteristic equation of the system]. 퐷(푧)  The solutions, 훾푖, of 퐷(푧) = 0 are the system poles or natural frequencies (generally complex valued). 푘  LTIDT system natural modes take the form, 훾푖 . Stability requires |훾푖| < 1 for all 훾푖.

Fourier Series:

 The Fourier series allows us to express a periodic signal 푓(푡), with a fundamental frequency 휔표, as the sum of a constant (signal average) and an infinite number of harmonic sinusoids. ∞  Compact trigonometric Fourier series: 푓(푡) = 퐶0 + ∑푛=1 퐶푛 cos(푛휔표푡 + 휃푛) +∞ 푗푛휔0푡  Exponential Fourier series: 푓(푡) = ∑푛=−∞ 퐷푛푒 1 2 2 1 ∞ 2 2 +∞ 2  Parseval’s theorem: ∫ 푓 (푡)푑푡 = 퐶0 + ∑푛=1 퐶푛 = 퐷0 + 2 ∑푛=1|퐷푛| 푇0 푇0 2

Laplace Transform (one sided):

∞ 퐹(푠) = ∫ 푓(푡)푒−푠푡 푑푡 0−

 Transforms a CT signal, 푓(푡), into a complex signal, 퐹(푠), in the 푠-domain (푠 = 휎 + 푗휔).  Table of Laplace transform pairs 푓(푡) ↔ 퐹(푠) and Laplace transform properties are available that allow us to find 퐹(푠) from 푓(푡) and 푓(푡) from 퐹(푠), and avoid using integration.  The Laplace transform simplifies the analysis of a LTICT system by transforming its linear differential equation into an algebraic equation: 푄(푠)푌(푠) + 퐼(푠) = 푃(푠)퐹(푠), where 푦(푡) ↔ 푌(푠) and 푓(푡) ↔ 퐹(푠). Here, 푄(푠), 푃(푠) and 퐼(푠) are polynomials. 퐼(푠) depends only on the system’s initial conditions. 푌(푠) 푃(푠)  Such algebraic equation can then be solved to obtain the transfer function 퐻(푠) = = , where 퐼(푠) is set to zero 퐹(푠) 푄(푠) (i.e., initial conditions are set to zero).  The system’s unit-impulse response, ℎ(푡), and the transfer function, 퐻(푠), form a Laplace transform pair: ℎ(푡) ↔ 퐻(푠)  The Laplace transform can be used to analyze stable and unstable LTICT systems. It can generate the response: 퐼(푠) 푃(푠) 푌(푠) = 푌 (푠) + 푌 (푠), where 푌 (푠) = − and 푌 (푠) = 퐹(푠) = 퐻(푠)퐹(푠) 푧푖 푧푠 푧푖 푄(푠) 푧푠 푄(푠) 퐼(푠)  Performing the inverse Laplace transformation on 푌 (푠) = − and 푌 (푠) = 퐻(푠)퐹(푠) (which involves applying 푧푖 푄(푠) 푧푠 partial fraction expansion and the use of the Laplace Transform Table) leads to the decoupled time-domain solution: 퐼(푠) 푦(푡) = 푦 (푡) + 푦 (푡) = 퐿−1 {− } + 퐿−1{퐻(푠)퐹(푠)} 푧푖 푧푠 푄(푠)  In addition to the analysis of LTICT systems, the Laplace transform finds important applications in automatic control.

Fourier Transform:

+∞ 퐹(휔) = ∫ 푓(푡)푒−푗휔푡푑푡 −∞

 Transforms a CT signal, 푓(푡), into a complex signal, 퐹(휔), in the 휔-domain.  Tables of Fourier transform pairs, 푓(푡) ↔ 퐹(휔), and Fourier transform properties are available to assist in obtaining the transform and its inverse. ∞  If a causal signal 푓(푡) is absolutely integrable (i.e., |푓(푡)|푑푡 < ∞), and has a Laplace transform 퐹(푠), then (and ∫0− only then) the Fourier transform of 푓(푡) can be obtained from 퐹(푠) as 퐹(휔) = 퐹(푠)|푠=푗휔.  Similarly, the frequency response function 퐻(휔) of a stable LTICT system can be obtained from the transfer function 퐻(푠) by simply replacing 푠 by 푗휔.  The Fourier transform can’t handle initial conditions like the Laplace transform. Therefore, it can’t be used to obtain the 푦푧푖(푡) component of the response. However, if the system is stable, the Fourier transform can be used to obtain the −1 −1 zero-state response according to the formula: 푦푧푠(푡) = 퐹 {퐻(휔)퐹(휔)}. Here, the notation 퐹 {} stands for the inverse Fourier transform.  If 푓(푡) is a constant, an everlasting sinusoid or (more generally) an everlasting periodic signal, then 퐹−1{퐻(휔)퐹(휔)} gives the steady-state response, 푦푠푠(푡).  The response of a stable system to a periodic 푓(푡), that is expressed in terms of its trigonometric Fourier ∞ series, 푓(푡) = 퐶0 + ∑푛=1 퐶푛 cos(푛휔표푡 + 휃푛), is given by the formula ∞

푦푠푠(푡) = 퐻(0)퐶0 + ∑|퐻(푛휔0)|퐶푛 cos[푛휔0푡 + ∠퐻(푛휔0) + 휃푛] 푛=1 +∞ 푗푛휔0푡  For a periodic 푓(푡) that is expressed in terms of its exponential Fourier series 푓(푡) = ∑푛=−∞ 퐷푛푒 the steady-state response is determined using the formula +∞ +∞

푗푛휔0푡 푗[푛휔0푡+∠퐻(푛휔0)+∠퐷푛] 푦푠푠(푡) = ∑ 퐻(푛휔0)퐷푛푒 = ∑ |퐻(푛휔0)||퐷푛|푒 푛=−∞ 푛=−∞  The Fourier transform is very useful in many applications including the analysis and design of communication systems, design of analog filters, sampling theory, and in determining a signal’s bandwidth. We can express the bandwidth equation for a signal 푓(푡) as (훼 is typically set to a value between 0.95 and 0.99). 휔 퐵|퐹(휔)|2푑휔 ∫0 ∞ = 훼 |퐹(휔)|2푑휔 ∫0  The above equation can be solved (analytically or numerically) for 휔퐵 from which we define the signal’s effective 휔 bandwidth (in Hz) as 퐵 = 퐵 Hz. 2휋 The Z-Transform:

∞ 퐹(푧) = ∑ 푓[푘]푧−푘 푘=−∞

 Transforms a DT signal, 푓[푘], into a complex signal, 퐹(푧), in the 푧-domain (푧 is complex)  Tables of Z-transform pairs, 푓[푘] ↔ 퐹(푧), and Z-transform properties are available to assist in obtaining the transform and its inverse.

 The Z-transform simplifies the analysis of a LTIDT system by transforming its linear difference equation into an algebraic equation: 푄(푧)푌(푧) + 퐼(푧) = 푃(푧)퐹(푧), where 푦[푘] ↔ 푌(푧) and 푓[푘] ↔ 퐹(푧). Here, 푄(푧), 푃(푧) and 퐼(푧) are polynomials. 퐼(푧) depends only on the system’s initial conditions. 푌(푧) 푃(푧)  Such algebraic equation can then be solved to obtained the transfer function 퐻(푧) = = , where 퐼(푧) is set to 퐹(푧) 푄(푧) zero (i.e., initial conditions are set to zero).  The system’s unit-impulse response, ℎ[푘], and the transfer function, 퐻(푧), form a Z-transform pair: ℎ[푘] ↔ 퐻(푧).  The Z-transform can be used to analyze stable and unstable LTIDT systems. It can generate the response: 푌(푧) = 퐼(푧) 푃(푧) 푌 (푧) + 푌 (푧), where 푌 (푧) = − and 푌 (푧) = 퐹(푧) = 퐻(푧)퐹(푧) 푧푖 푧푠 푧푖 푄(푧) 푧푠 푄(푧) 퐼(푧)  Performing the inverse Z-transformation on 푌 (푧) = − and 푌 (푧) = 퐻(푧)퐹(푧) (which involves applying partial 푧푖 푄(푧) 푧푠 fraction expansion and the use of the Z-transform Table) leads to the coupled time-domain solution: 퐼(푧) 푦[푘] = 푦 [푘] + 푦 [푘] = 푍−1 {− } + 푍−1{퐻(푧)퐹(푧)} 푧푖 푧푠 푄(푧)

Discrete-Time Fourier Transform (DTFT):

∞ 퐹(Ω) = ∑ 푓[푘]푒−푗Ω푘 푘=−∞

휔 where Ω = 푇푠휔 = is the discrete-time angular frequency (measured in rad/sample), and 푓푠 is the sampling 푓푠 frequency.

 The DTFT transforms a DT signal, 푓[푘], into a complex signal, 퐹(Ω), in the complex Ω-domain.  Tables of DTFT pairs, 푓[푘] ↔ 퐹(Ω), and DTFT properties are available to assist in obtaining the transform and its inverse. ∞  If a causal signal 푓[푘] is absolutely summable (i.e., ∑푘=−∞|푓[푘]| < ∞) and has a Z-transform 퐹(푧), then (and only then) the DTFT of 푓[푘] can be obtained from 퐹(푧) as 퐹(Ω) = 퐹(푧)|푧=푒푗Ω  The frequency response function 퐻(Ω) of a stable LTIDT system can be obtained from the transfer function 퐻(푧) by simply replacing 푧 by 푒푗Ω.  The DTFT relationship to the Z-transform is very similar to that of the (CT) Fourier transform and the Laplace transform.

 The DTFT can’t handle initial conditions like the Z-transform. Therefore, it can’t be used to obtain the 푦푧푖[푘] component of the response. However, if the system is stable, the DTFT can be used to obtain the zero-state response −1 −1 according to the formula: 푦푧푠[푘] = 퐹 {퐻(Ω)퐹(Ω)}. Here, the notation 퐹 {} stands for the inverse DTFT.  If 푓[푘] is a constant, an everlasting sinusoid or (more generally) an everlasting periodic signal then 퐹−1{퐻(Ω)퐹(Ω)} gives the steady-state response, 푦푠푠[푘].  The response of a stable system to a periodic 푓[푘] that is expressed in terms of its trigonometric Fourier series, 푓[푘] = 푚 퐶0 + ∑푖=1 퐶푖cos (Ω푖푘 + 휃푖) is 푚

푦푠푠[푘] = 퐻(0)퐶0 + ∑|퐻(Ω푖)|퐶푖 cos[Ω푖푘 + ∠퐻(Ω푖) + 휃푖] 푖=1  The DTFT is of fundamental importance in the design of recursive (digital) filters. It is also applicable to the analysis of truncation error in numerical algorithms.