Digital Signal Processing I EEE 313 Dept. of EEE, BUBT Signal “Stream of information that varies with some variables” • Continuous Signal: sin(Ωt) • Discrete Signal: sin(ωn) Types by dimension: ο1D: Audio, ECG ο2D: Photograph ο3D: Video All natural signals are analog. When an analog signal is sampled, quantized and coded, it becomes a digital signal. Sampling x(t) = A cos(Ωt) After sampling with Ts interval, x(nTs) = A cos(ΩnTs) = A cos(2πFnTs) = A cos(2πnF/Fs) = A cos(2πfn) • Ω = Analog Angular Frequency (rad/second) = 2πF • F = Analog Frequency (cycle/second) • Fs = Sampling Frequency (sample/second) = 1 / Ts • f = Discrete Time Frequency (cycle/sample) = F / Fs Example: f = 1/70 means “70 samples are collected in 1 cycle”. Nyquist's Sampling Theorem “A bandlimited continuous-time signal can be perfectly reconstructed from its samples if the waveform is sampled over twice as fast as its highest frequency component.” For lossless reconstruction, Fs ≥ 2F or, F / Fs ≤ 1 / 2 or, f ≤ 1 / 2 So, fmax can be 1 / 2. Note: Smaller f is better. Because smaller f means: more samples are taken in each cycle. Nyquist (continued)… Fs = 1.9 F Fs = 2 F Fs = 1.1 F Periodicity π₯ π + π = π΄ cos π π + π Previously, period was time. But here, period is sample. Also, ω = 2πf = 2πk/N, and k is integer. π₯ π + π = π΄ cos ππ + ππ 2ππ = π΄ cos ππ + π π = π΄ cos ππ + 2ππ = π΄ cos ππ =π₯ π Note: f (= k/N) must be rational number. Question: Is “15 cos 5πn ” a valid representation of discrete-time signal? Also find for “15 cos 10n ”. ο15 cos Here, π = 5ππ = 15 cos 2π 5 2 5 2 π , which can not be a rational number. So, NOT a valid representation. 5 ο15 cos 10π = 15 cos 2π π π 5 Here, π = , which can not be a rational number (because π is irrational) π So, NOT a valid representation. Question: π₯(π‘) = 20 cos Ω1 π‘ + 30 cos Ω2 π‘ , where πΉ1 = 2000 Hz and πΉ2 = 3000 Hz. What is the minimum sampling frequency for lossless reconstruction? Find the expression of π₯ π for 4000 Hz sampling frequency. πΉπ(πππ) must be twice the maximum frequency component in π₯ π‘ . So, it should be 6000 Hz. Now, π₯ π‘ = 20 cos Ω1 π‘ + 30 cos Ω2 π‘ = 20 cos 2ππΉ1 π‘ + 30 cos 2ππΉ2 π‘ = 20 cos 2π2000π‘ + 30 cos 2π3000π‘ So, π₯ π = 20 cos 2π 2000Τ4000 π + 30 cos 2π 3000Τ4000 π 1 3 = 20 cos 2π π + 30 cos 2π π 2 4 continued… Red: 20 cos 2π2000π‘ Blue: 30 cos 2π3000π‘ Green: 20 cos 2π2000π‘ + 30 cos 2π3000π‘ Time-Shifting of DT Sequence Delay Advance y[n] = x[n - d], where d is integer. y[n] = x[n + a], where a is integer. Let, x[n] = [… 2 5 7 6 9 1 …] y[n] = x[n-1] y[-1] = x[-1-1] = x[-2] = 2 y[0] = x[0-1] = x[-1] = 5 y[1] = x[1-1] = x[0] = 7 y[2] = x[2-1] = x[1] = 6 and so on. So, y[n] = [… 2 5 7 6 9 1 …] Let, x[n] = [… 2 5 7 6 9 1 …] y[n] = x[n+1] y[-1] = x[-1+1] = x[0] = 7 y[0] = x[0+1] = x[1] = 6 y[1] = x[1+1] = x[2] = 9 y[2] = x[2+1] = x[3] = 1 and so on. So, y[n] = [… 2 5 7 6 9 1 …] Basic Properties of Discrete-Time System (1) Memory A system is memoryless if output depends only on present value. Let, π¦ π = π π₯ π = π₯ 2 π , where T{x[n]} means a transform in a system. Now, π¦ 5 = π₯ 2 5 , π¦ 17 = π₯ 2 17 and so on. It is memoryless. Now let, π¦ π = π π₯ π = π₯ π + π₯ π − 2 . Thus, π¦ 5 = π₯ 5 + π₯ 3 , it depends on past value. It needs memory. continued… Now let, π¦ π = π π₯ π = π₯ π + π₯ π + 3 . Thus, π¦ 5 = π₯ 5 + π₯ 8 , it depends on future value. It needs memory. Question: x[n] = [9 6 5 1 4 0 7 0 3 …]; π¦ π = π π₯ π = π₯ π − π₯[π + 1]. Find y[-1], y[0], y[1], y[2], y[3]. Is this system memoryless? y[-1] = x[-1] – x[0] = 1 – 4 = -3 y[0] = x[0] – x[1] = 4 – 0 = 4 y[1] = x[1] – x[2] = 0 – 7 = -7 y[2] = x[2] – x[3] = 7 – 0 = 7 y[3] = x[3] – x[4] = 0 – 3 = -3 The system depends on future values. So, not memoryless. continued… (2) Linearity A system is linear if it satisfies additivity & homogeneity of degree one. (a) Additivity: For every pair of signal x1[n] and x2[n], π π₯1 π + π₯2 π = π π₯1 π + π π₯2 π (b) Homogeneity of degree one: For every signal x[n] and scalar a, π ππ₯ π = π π π₯ π Combining these two, π ππ₯1 π + ππ₯2 π = π π π₯1 π + ππ π₯2 π For example, let, π¦ π = π π₯ π = π₯ 2 π . Now, π₯1 π + π₯2 π 2 ≠ π₯1 2 π + π₯2 2 π . So, it’s non-linear. continued… Additivity Homogeneity continued… Question: x1[n] = [ 2 0 4 6 …]; x2[n] = [ 1 3 2 7 …]. Using these sequences, show if linearity holds for the following system: y[n] = T{x[n]} = x2[n]. π¦1 π = π ππ₯1 π + ππ₯2 π = 2+1 2 0+3 2 4+2 2 6+7 2 … = [ 9 9 36 169 … ] π¦2 π = π π π₯1 π + ππ π₯2 π = 22 + 1 2 02 + 32 42 + 22 = 5 9 20 85 … So, π¦1 ≠ π¦2 The system is non-linear. 62 + 72 … continued… Question: x1[n] = [ 2 0 4 6 …]; x2[n] = [ 1 3 2 7 …]. Using these sequences, show if linearity holds for the following system: y[n] = T{x[n]} = 2x[n]. π¦1 π = π ππ₯1 π + ππ₯2 π = 2 2+1 2 0+3 2 4+2 2 6+7 … = 6 6 12 26 … π¦2 π = π π π₯1 π + ππ π₯2 π = [ (4 + 2) 0 + 6 8 + 4 12 + 14 … ] = [ 6 6 12 26 … ] So, π¦1 = π¦2 The system is linear. continued… (3) Time-Invariance A system is time-invariant if for all nd, the input with values π₯1 π = π₯ π − ππ produces output with values π¦1 π = π¦ π − ππ . In other words: (a) Get your output with no input delay, then delay the output. (b) Delay the input, then get output. If both cases are matched, the system is time-invariant. continued… Let, π¦ π = π π₯ π = π₯ 2π x[n] = [… a b c d e f g h …] y[n] = [… b d f h …] y1[n] = y[n-1] = [… b d f h …] x[n-1] = [… a b c d e f g h …] y2[n] = [… a c e g …] Here, π¦1 π ≠ π¦2 π . So, it’s time-variant. ; y[0]=x[0], y[-1]=x[-2], y[1]=x[2], y[2]=x[4] [output is delayed]; y1[0]=y[-1], y1[1]=y[0], y1[2]=y[1] [input is delayed] [output for delayed input] continued… Let, π¦ π = π π₯ π = π₯ 3π x[n] = [… 2 4 3 8 6 4 2 1 4 9 5 9 7 …] y[n] = [… 2 8 2 9 7 …] ; y[0]=x[0], y[-1]=x[-3], y[1]=x[3], y[2]=x[6] y1[n] = y[n-1] = [… 2 8 2 9 7…] [output is delayed]; y1[-1]=y[-2], y1[0]=y[-1] x[n-1] = [… 2 4 3 8 6 4 2 1 4 9 5 9 7 …] [input is delayed] y2[n] = [… 3 4 4 9 …] [output for delayed input] Here, π¦1 π ≠ π¦2 π . So, it’s time-variant. continued… Let, π¦ π = π π₯ π = 5π₯ π x[n] = [… 4 1 2 5 0 1 …] y[n] = [… 20 5 10 25 0 5 …] y1[n] = y[n-1] = [… 20 5 10 25 0 5 …] x[n-1] = [… 4 1 2 5 0 1 …] y2[n] = [… 20 5 10 25 0 5 …] Here, π¦1 π = π¦2 π . So, it’s time-invariant. [output is delayed]; y1[0]=y[-1], y1[1]=y[0] [input is delayed] [output for delayed input] Linear Time-Invariant (LTI) System Unit impulse, Now let, 1, π = 0 πΏ π =α 0, π ≠ 0 π₯ π = 5 7 9 2 4 1… = 5πΏ π + 7πΏ π − 1 + 9πΏ π − 2 + β― π=∞ = ΰ· π₯ π πΏ[π − π] π=−∞ Now, π=∞ π¦ π =π π₯ π =π ΰ· π₯ π πΏ[π − π] π=−∞ continued… If linearity holds, then π=∞ π¦ π =π π=∞ ΰ· π₯ π πΏ[π − π] = ΰ· π₯ π π πΏ[π − π] π=−∞ π=−∞ And, for time-invariance, the impulse response, β π = π πΏ[π] β π − π = π πΏ[π − π] So, for LTI system, π=∞ π=∞ π¦ π = ΰ· π₯ π β[π − π] = ΰ· β π π₯[π − π] π=−∞ π=−∞ Convolution Sum Formula π=∞ π=∞ π¦ π = ΰ· π₯ π β[π − π] = ΰ· β π π₯[π − π] π=−∞ π=−∞ Using convolution sum, we can predict output for any kind of input without physically putting on the equipment. Some properties of convolution: • Commutative: π₯ π ∗ β π = β π ∗ π₯ π • Associative: π₯ π ∗β π ∗π€ π =π₯ π ∗ β π ∗π€ π • Distributive: π₯ π ∗ β π + π€ π = π₯ π ∗ β π + π₯ π ∗ π€[π] (4) Stability A system is stable if bounded input produces bounded output. [BIBO] π₯[π] ≤ π΅π₯ ; π¦[π] ≤ π΅π¦ We know, π¦ π = σπ=∞ π=−∞ π₯ π β[π − π] for LTI system. For stability of LTI system, π=∞ π¦[π] ≤ ΰ· π₯ π π=−∞ β π−π π=∞ βΉ π¦[π] ≤ π΅π₯ ΰ· β π − π π=−∞ So, σπ=∞ π=−∞ β[π] < ∞ (Necessary & Sufficient condition) This means, impulse response must be absolutely summable. Question: Find if the following systems are stable or not: • y[n] = x[n] – x[n+1] If input is bounded, then difference between bounded values will also be bounded. So, the system is stable. • y[n] = x[n] + 7 If input is bounded, then addition of bounded values will also be bounded. So, the system is stable. • y[n] = log (x[n]) If 0 is found anywhere in the sequence x[n], then output becomes log(0) = – ∞. So, the system is unstable. • y[n] = n x[n] Even if input is bounded, we don’t know the boundary of n. So, the system is unstable. Definitions • Causal: A causal system is one whose output depends only on the present and the past inputs. • Non-Causal: A system that has some dependence on input values from the future (in addition to possible dependence on past or current input values) is termed a non-causal or acausal system • Anti-Causal: A system that depends solely on future input values is an anticausal system. (5) Causality A system is causal if output depends on present and/or past input. y[n] = 4x[n] System is causal. y[n] = 2x[n-1] System is causal. y[n] = 7x[n] + 5x[n-1] System is causal. y[n] = 7x[n] + 5x[n+1] System is non-causal. y[n] = 5x[n+1] System is anti-causal & non-causal. Note: 1. All anti-causal systems are non-causal, but not the opposite. 2. All memoryless systems are causal. 3. Real-time system can not be non-causal. continued… We know, π¦ π = σπ=∞ π=−∞ β π π₯[π − π] for LTI system. or, π¦ π = β― + β −2 π₯ π + 2 + β −1 π₯ π + 1 + β 0 π₯ π + β 1 π₯ π−1 +β 2 π₯ π−2 +β― For casual system, future values don’t exist. So, h[-1] = h[-2] = h[-3] = … = 0 Simply, for any LTI system to be causal: h[k] = 0, when k < 0 Question: x[n]=[ 1 2 3 ], h[n]=[ 4 5 6 ]. Find the convolution. 1 y[0] = 4 y[1] = 5+8 = 13 y[2] = 6+10+12 = 28 y[3] = 12+15 = 27 y[4] = 18 So, y[n] = [ 4 13 28 27 18 ] 6 5 6 2 3 1 2 3 5 4 1 2 3 6 5 4 1 2 3 6 5 2 3 4 1 6 4 5 4 Question: x[n]=[ 1 2 3 4 5 ], h[n]=[ 4 5 6 ]. Find the convolution. y[0] = 12+15+16 = 43 y[1] = 18+20+20 = 58 y[2] = 24+25 = 49 y[3] = 30 y[-1] = 6+10+12 = 28 y[-2] = 5+8 = 13 y[-3] = 4 1 2 3 4 5 So, y[n] = [4 13 28 43 58 49 30] 1 2 3 4 5 6 5 4 6 5 4 1 2 3 4 5 6 5 4 1 2 3 4 5 6 5 4 1 2 3 4 5 6 5 4 1 2 3 4 5 6 5 4 1 2 3 4 5 6 5 4 Convolution (graph) Quantization “Process of mapping continuous infinite values to a smaller set of discrete finite values” Quantization by Rounding Quantization by Truncation Question: Quantize the sequence using integer rounding and truncation: x[n]= [ 7.4 2.3 6.5 5.7 9.2 -0.6 -1.9 0.5 -9.6 -2 -0.5 ]. Also find the error sequence. • Rounding: xq[n]=[ 7 2 Error: e[n] = [ -0.4 • Truncation: xq[n] = [ 7 2 Error: e[n] = [ -0.4 7 6 9 -1 -2 1 -10 -2 -1 ] -0.3 0.5 0.3 -0.2 -0.4 -0.1 0.5 -0.4 0 -0.5 ] 6 5 9 0 -1 0 -9 -2 0 ] -0.3 -0.5 -0.7 -0.2 0.6 0.9 -0.5 0.6 0 0.5 ] SQNR for Rounding • x[n] = Sample input • xq[n] = Quantized output • • • • • e[n] = Quantization error Δ = Step size or Resolution xmin = minimum of x[n] xmax = maximum of x[n] L = Number of level β β 2 2 Now, − ≤ π[π] ≤ where π₯πππ₯ − π₯πππ β= πΏ−1 SQNR: Signal to Quantization Noise Ratio continued… If the signal is sinusoid, then xmax= A, xmin= - A. For coding, if number of bits used is b, π₯πππ₯ −π₯πππ 2π΄ 2π΄ then β= = π ≈ π [when b is higher] πΏ−1 2 −1 2 ππ₯ π΄π£π πππ€ππ ππ ππππππ ππππ = = ππ π΄π£π πππ€ππ ππ πΈππππ βΰ΅ 2 3 1 1 π 2 ππ = ΰΆ± π ππ = β −βΰ΅ β 3 2 And, for sinusoid, ππ₯ = π΄2 2 βΰ΅ 2 −βΰ΅ 2 β2 = 12 continued… So, ππππ = π΄2 Τ2 ΰ΅ β2Τ12 = π΄2 Τ2 ΰ΅ 4π΄2 22π ΰ΅12 β΅ β= 3 = β 22π 2 ∴ ππππ ππ΅ = 10 log10 (ππππ ) 3 = 10 log10 β 22π 2 3 = 10 log10 + log10 22π 2 = 10 0.176 + 0.6π = π. ππ + ππ 2π΄ 2π log(ab) = log(a) + log(b) Question: An A/D converter uses 7-bit uniform rounding quantization for a sinusoidal signal. Find the SQNR(dB). If 8-bit was used, what would be the improvement in SQNR(dB)? If the sinusoid’s amplitude is 17, find resolution in both cases. • For 7-bit, SQNR(dB) = (1.76 + 6 x 7) dB = 43.76 dB • For 8-bit, SQNR(dB) = (1.76 + 6 x 8) dB = 49.76 dB So, the improvement is (49.76 – 43.76) dB, or, 6 dB • Resolution for 7-bit, Δ1 = (2 x 17) / (27) = 0.2656 • Resolution for 8-bit, Δ2 = (2 x 17) / (28) = 0.1328 Linear Constant-Coefficient Difference Equation (LCCDE) π¦ π + π1 π¦ π − 1 + π2 π¦ π − 2 + β― + ππ π¦ π − π = π0 π₯ π + π1 π₯ π − 1 + π2 π₯ π − 2 + β― + ππ π₯[π − π] Solution: • Homogeneous [zero-input], yh[n] • Particular [steady-state], yp[n] Total solution = y[n] = yh[n] + yp[n] y[n] = x[n] + 7 y[n-1] or, y[n] – 7 y[n-1] = x[n] Example: Find the homogeneous solution of a system described by the 1st-order difference equation: π¦[π] + 5π¦[π − 1] = π₯[π] --------(i) We know, π¦β π = πΆ1 π1 π + πΆ2 π2 π + β― + πΆπ ππ π [for order N] Now, for eqn (i), π¦β π = πΆππ [because it is 1st order] Then, we substitute an assumed solution (for x[n]=0) in eqn (i). ππ + 5ππ−1 = 0 βΉ ππ−1 π + 5 = 0 βΉ π = −5 So, the solution becomes π¦β π = πΆ −5 π -------(ii) For n=0 (with x[n]=0), eqn (i) becomes π¦[0] + 5π¦[−1] = 0 βΉ π¦[0] = −5π¦[−1] For n=0, eqn (ii) becomes π¦β [0] = πΆ continued… So, πΆ = − 5π¦[−1] Then we substitute πΆ in eqn (ii), π¦β π = −5 π¦ −1 −5 π βΉ π¦β π = −5 π+1 π¦ −1 ∴ π¦β π = (−5)π+1 π¦ −1 , π ≥ 0 Note: If the value of y[−1] is given, it must be included in the solution. For y[−1] = 2, π¦β π = 2 β (−5)π+1 , π ≥ 0 Example: Find the homogeneous solution of a system described by the 2nd-order difference equation: π¦ π − 3π¦ π − 1 − 4π¦[π − 2] = 0 --------(i) π π π We know, π¦β π = πΆ1 π1 + πΆ2 π2 + β― + πΆπ ππ [for order N] π π Now, for eqn (i), π¦β π = πΆ1 π1 + πΆ2 π2 [because it is 2nd order] Then, we substitute an assumed solution in eqn (i). ππ − 3ππ−1 − 4ππ−2 = 0 βΉ ππ−2 π2 − 3π − 4 = 0 βΉ π2 − 3π − 4 = 0 βΉ π = −1, 4 So, the solution becomes π¦β π = πΆ1 −1 π + πΆ2 4 π -----(ii) From eqn (i), π¦ π = 3π¦ π − 1 + 4π¦[π − 2] ∴ π¦ 0 = 3π¦ −1 + 4π¦[−2] πππ, π¦ 1 = 3π¦ 0 + 4π¦[−1] continued… βΉ π¦ 1 = 3 3π¦ −1 + 4π¦ −2 + 4π¦[−1] βΉ π¦ 1 = 13π¦ −1 + 12π¦[−2] From eqn (ii), π¦ 0 = πΆ1 + πΆ2 πππ, π¦ 1 = −πΆ1 + 4πΆ2 ∴ πΆ1 + πΆ2 = 3π¦ −1 + 4π¦[−2] -----(iii) πππ, −πΆ1 + 4πΆ2 = 13π¦ −1 + 12π¦[−2] -----(iv) After solving eqn (iii) and (iv), −1 4 πΆ1 = π¦ −1 + π¦[−2] 5 5 16 16 πΆ2 = π¦ −1 + π¦[−2] 5 5 −1 4 ∴ π¦β π = π¦ −1 + π¦[−2] 5 5 −1 π 16 16 + π¦ −1 + π¦[−2] 5 5 4 π for π ≥ 0 Correlation “Measure of similarity between signals” Use: radar, sonar, GPS etc. • Crosscorrelation: π=∞ ππ₯π¦ π = ΰ· π₯ π π¦[π − π] π=−∞ • Autocorrelation: π=∞ ππ₯π₯ π = ΰ· π₯ π π₯[π − π] π=−∞ Convolution vs Crosscorrelation vs Autocorrelation rfg rff rgf rgg Question: Find rxy[n] and ryx[n] for the following: x[n]=[ 7 4 6 1 ], y[n]=[ 1 0 1 9 ]. rxy[0] = 0+4+54 = 58 rxy[1] = 7+0+6+9 = 22 rxy[2] = 4+0+1 = 5 rxy[3] = 6+0 = 6 rxy[4] = 1 rxy[-1] = 7+36 = 43 rxy[-2] = 63 So, rxy[n] = [ 63 43 58 22 5 6 1 ] And, ryx[n] = [ 1 6 5 22 58 43 63 ] 7 4 6 1 1 0 1 9 7 4 6 1 1 0 1 9 7 4 6 1 1 0 1 9 7 4 6 1 1 0 1 9 7 4 6 1 1 0 1 9 7 4 6 1 1 0 1 9 7 4 6 1 1 0 1 9 Question: Find autocorrelation for the following: x[n]=[ 7 4 6 ] rxx[0] = 49+16+36 = 101 rxx[1] = 28+24 = 52 rxx[2] = 42 rxx[-1] = 28+24 = 52 rxx[-2] = 42 So, rxx[n] = [ 42 52 101 52 42 ] 7 4 6 7 4 6 7 4 6 7 4 4 6 7 7 7 7 4 7 4 4 6 7 4 6 6 6 6 4 6 continued… Normalized Correlation Sequence ππ₯π₯ [π] ππ₯π₯ [π] = ππ₯π₯ [0] ππ₯π¦ π = ππ₯π¦ [π] ππ₯π₯ 0 β ππ¦π¦ [0] For example, if ππ₯π₯ π = [5 10 20 10 5] then ππ₯π₯ π = [0.25 0.5 1 0.5 0.25] Discrete Time Fourier Transform (DTFT) π=∞ π π ππ = ΰ· π₯ π π −πππ π=−∞ π π ππ is a continuous function of ω, where ω = ΩTs. π π ππ is periodic with period of 2π. π π ππ = π π π(π+2ππ) where k is any integer To convert π π ππ to x[n], inverse DTFT (IDTFT) is applied: 1 π π₯π = ΰΆ± π π ππ π πππ ππ 2π −π continued… Discrete & Aperiodic π 1 π₯π = ΰΆ± π π ππ π πππ ππ 2π −π Continuous & Periodic π=∞ π π ππ = ΰ· π₯ π π −πππ π=−∞ continued… Existence of DTFT Spectra • Sufficient condition: π π ππ is generally complex. • Magnitude spectrum: π π ππ π=∞ π π ππ ≤ ΰ· π₯ π <∞ π=−∞ x[n] must be absolutely summable. Then, DTFT converges to a finite result for all ω. = ℜ π π ππ • Phase spectrum: β‘ π π ππ 2 + ℑ π π ππ = tan−1 ℑ π π ππ ℜ π π ππ Note: Both are continuous & periodic. 2 continued… Unit Impulse πΏ π =α 1, 0, π=0 π≠0 δ[n] = [ … 0 0 0 0 1 0 0 0 0 … ] Unit Step π’ π =α 1, 0, π≥0 π<0 u[n] = [ … 0 0 0 0 1 1 1 1 1 … ] Question: Find the DTFT of x[n] = u[n] – u[n-3] u[n] u[n-3] x[n] = [… 0 0 0 0 0 1 1 1 1 1 1 1 1 …] = [… 0 0 0 0 0 0 0 0 1 1 1 1 1 …] = [… 0 0 0 0 0 1 1 1 0 0 0 0 0 …] We know, π=∞ π π ππ = ΰ· π₯ π π −πππ π=2 π=−∞ = ΰ· π₯ π π −πππ π=0 = π₯ 0 π −ππ0 + π₯ 1 π −ππ1 + π₯ 2 π −ππ2 = 1 + π −ππ + π −2ππ Question: Find the DTFT of π₯ π = π=∞ We know, π=∞ βΉπ π π ππ = ΰ· π₯ π π −πππ π=−∞ π=∞ π = ΰ· 1ΰ΅2 π’[π]π −πππ π=−∞ But, u[n] = 0 when n < 0. So, π=∞ π π ππ π 1 = ΰ· ΰ΅2 π −πππ π=0 u[n] 1Τ π π’[π] 2 1 −ππ = π 2 0 π ππ 1 −ππ = ΰ· π 2 1 + π 2 1 −ππ =1+ π 2 π=0 1 −ππ 1 π 1 −ππ + π 2 1 −ππ + π 2 2 +β― 2 +β― This is a convergent geometric series (because the |ratio| is < 1) 1 ππ ∴π π = 1 −ππ 1− π 2 [ using formula π∞ = π 1−π ] Question: Find the IDTFT of πΰ΅ ≤ π ≤ πΰ΅ 1, − ππ 4 4 X π =ΰ΅ 0, ππ‘βπππ€ππ π We know, 1 π π₯π = ΰΆ± π π ππ π πππ ππ 2π −π 1 πΤ4 πππ βΉπ₯ π = ΰΆ± π ππ 2π −πΤ4 1 1 πππ πΤ4 = β π −πΤ4 2π ππ π 1 1 π 4π = β π −π ππ 2π 1 π = sin π ππ 4 π −π 4 π π ππ −π −ππ 2π [ We know, sin π = ] 1 1 π βΉ π₯ π = β π sin π 4 4 π 4 1 π βΉ π₯ π = π πππ π 4 4 continued… 1 π π₯ π = π πππ π 4 4 Some Properties of DTFT • Linearity π·ππΉπ π₯ π = ππ₯1 π + ππ₯2 π π π ππ = ππ1 π ππ + ππ2 π ππ • Time Delay π·ππΉπ π¦ π =π₯ π−π π π ππ = π π ππ π −πππ • Frequency Shift π·ππΉπ πππ π π¦ π =π π₯π π π ππ = π π π π−ππ • Convolution π·ππΉπ π¦ π =π₯ π ∗β π π π ππ = π π ππ π» π ππ • Differentiation π·ππΉπ π ππ π¦ π = ππ₯ π π π =π π π ππ ππ continued… • Time Reversal π·ππΉπ π¦ π = π₯ −π • Conjugation ∗ π¦ π =π₯ π π·ππΉπ • Modulation π¦ π = π₯ π cos π0 π π·ππΉπ π π ππ • Multiplication π₯ π = π₯1 π β π₯2 π • Parseval’s Theorem π·ππΉπ π π ππ π=∞ ΰ· π₯[π] π=−∞ 2 π π ππ = π π −ππ π π ππ = π ∗ π −ππ 1 = π ππ 2 π−π0 1 + π ππ 2 1 π = ΰΆ± π1 π ππ π2 π π 2π −π 1 π = ΰΆ± π π ππ 2π −π 2 ππ π+π0 π−π ππ Discrete Fourier Transform (DFT) Recall the DTFT of x[n], π=∞ π π = ΰ· π₯ π π −πππ π=−∞ Let’s sample X(ω) periodically frequency at a spacing of πΏπ. in Since X(ω) is periodic with period 2π, only samples in the fundamental frequency range are necessary. We take N equidistant samples in the 2π interval 0 ≤ π < 2π with spacing πΏπ = π=∞ π 2π π π = ΰ· π₯ π π −π2πππ/π π π=−∞ where k = 0,1,2,…,N–1 continued… But, the equally spaced frequency samples 2π π π After equidistant sampling of X(ω) for N ≥ L, π=πΏ−1 π do not uniquely represent the original sequence x[n] when x[n] has infinite duration. 2π π(π) ≡ π π = ΰ· π₯ π π −π2πππ/π π Instead, the frequency samples correspond to a periodic sequence of period N, that is an aliased version of x[n]. βΉ π(π) = ΰ· π₯ π π −π2πππ/π So, a finite-duration sequence x[n] of length L has a DTFT: π=πΏ−1 π π = ΰ· π₯ π π −πππ ; 0 ≤ π ≤ 2π π=0 π=0 π=π−1 π=0 where k = 0,1,2,…,N–1 The N-point inverse DFT (IDFT): π=π−1 1 π₯π = ΰ· π(π)π π2πππ/π π π=0 where n = 0,1,2,…,N–1 continued… 1, 0 ≤ π ≤ πΏ − 1 Let’s see the DTFT and DFT of π₯ π = α ; πΏ = 10 0, ππ‘βπππ€ππ π Example: Find the 4-point DFT of x[n]=[ 2 1 7 5 ] π=3 π π = ΰ· π₯[π]π −π2πππ/4 π=0 where k = 0, 1, 2, 3 βΉ π π = π₯ 0 π 0 + π₯ 1 π −π2ππΤ4 + π₯ 2 π −π2π2πΤ4 + π₯[3]π −π2π3πΤ4 βΉ π π = 2 + π −πππΤ2 + 7π −πππ + 5π −π3ππΤ2 • π(0) = 2 + 1 + 7 + 5 = 15 • π 1 = 2 + π −ππΤ2 + 7π −ππ + 5π −π3πΤ2 = −5 + 4π • π 2 = 2 + π −ππ + 7π −ππ2 + 5π −π3π = 3 • π 3 = 2 + π −ππ3Τ2 + 7π −ππ3 + 5π −π3π3Τ2 = −5 − 4π Magnitude, π(π) = 15 Angle, β‘π π = [ 0 2.467 6.403 0 3 6.403 − 2.467 ] z-Transform π=∞ π π§ = ΰ· π₯ π π§ −π π=−∞ where z is a complex variable. π§ π₯[π] Υ π(π§) The Region of Convergence (ROC) of X(z) is the set of values of z for which X(z) attains a finite value. Example: Determine the z-transforms of the following finite-duration signals: • x1[n]=[ 9 2 4 6 3 1 ] X1(z)=9z2+2z+4+6z–1+3z–2+z–3, ROC: entire z-plane except z=0 and z=∞ • x2[n]=[ 1 0 7 9 5 ] X2(z)=1+7z–2+9z–3+5z–4, ROC: entire z-plane except z=0 More example: Determine the z-transforms of the following finite-duration signals: • x3[n]=δ[n] X3(z)=1 ; ROC: entire z-plane • x4[n]=δ[n–6] X4(z)=z–6 ; ROC: entire z-plane except π§ = 0 • x5[n]=δ[n+7] X5(z)=z7 ; ROC: entire z-plane except π§ = ∞ • x6[n]=[ 4 6 0 7 ] X6(z)=4z3+6z2+7; ROC: entire z-plane except π§ = ∞ Example: Determine the z-transform of the signal: π π₯ π = 1ΰ΅3 π’[π] We get, π₯ π = 1 Thus, π π§ = 1 1 1 2 1 3 1 4 3 3 3 3 1 −1 + π§ 3 + 1 2 3 π§ −2 + 1 −1 1 −1 =1+ π§ + π§ 3 3 2 1 3 3 So, <1βΉ π§ > π§ −3 + 1 −1 + π§ 3 Recall for infinite geometric series, π∞ = 1 −1 π§ 3 … π 1−π 3 1 4 3 1 −1 + π§ 3 4 +β― , where |π| < 1 1 3 π§ −4 + β― 1 1 ∴π π§ = ; π ππΆ: π§ > 1 −1 3 1− π§ 3 Existence of X(z) Let, π§ = ππ ππ , where π = π§ , and π = β‘π§ π=∞ π=∞ π π§ = ΰ· π₯[π]π§ −π = ΰ· π₯[π]π −π π −πππ π=−∞ π=−∞ In the ROC of X(z), π(π§) < ∞ π=∞ π(π§) = π=∞ ΰ· π₯[π]π −π π −πππ ≤ ΰ· π₯[π]π −π π=−∞ −π So, π(π§) is finite if π₯[π]π π=−∞ is absolutely summable. π=−1 π=∞ π(π§) ≤ ΰ· π₯ π π −π + ΰ· π₯[π]π −π π=−∞ π=0 continued… π=∞ π=∞ π(π§) ≤ ΰ· π₯ −π π π + ΰ· π₯[π]π −π π=1 π=0 • ROC for 1st sum consists of all points inside a circle of radius π1 • ROC for 2nd sum consists of all points outside a circle of radius π2 Thus, X(z) exists if π2 < π < π1 ο±If π2 > π1 , there is no common ROC, and X(z) doesn’t exist. continued… Recall the example: 1 π₯π = 3 π 1 1 π’ π Υπ π§ = ; π ππΆ: π§ > 1 −1 3 1− π§ 3 π§ Similarly, 1 π₯ π = π π’ π Υπ π§ = ; π ππΆ: π§ > π −1 1 − ππ§ where π can be real or complex. π π§ Example: Determine the z-transform of the signal: π₯ π = −5π π’[−π − 1] We get, π₯ π = … −5 Thus, π π§ = β― + −4 −1 54 −5 π§4 + 1 = − …+ π§ 5 −3 −2 −5 −1 53 4 π§3 + 1 + π§ 5 Recall for infinite geometric series, π∞ = So, 1 π§ 5 −5 −1 52 3 −1 π§2 + 1 + π§ 5 π 1−π π = [… 2 −1 5 −1 −1 −1 −1 54 53 52 5 π§1 1 + π§ 5 1 , where |π| < 1 <1βΉ π§ <5 1 π§ 1 5 ∴π π§ =− = ; π ππΆ: π§ < 5 −1 1 1 − π§ 1 − 5π§ 5 π] continued… Recall the previous example: 1 π₯ π = −5 π’ −π − 1 Υ π π§ = ; π ππΆ: π§ < 5 −1 1 − 5π§ Similarly, π§ 1 π π₯ π = −π π’ −π − 1 Υ π π§ = ; π ππΆ: π§ < π −1 1 − ππ§ where π can be real or complex. π π§ Example: Determine the z-transform of the signal: π₯ π = ππ π’ π + ππ π’[−π − 1] For the 1st term, π ππΆ: π§ > π For the 2nd term, π ππΆ: π§ < π ο§ If π > π , two ROC don’t overlap. So, X(z) doesn’t exist. ο§ If π < π , the ROC is ring-shaped. X(z) exists. π ππΆ: π < π§ < π For 2nd case, 1 1 π π§ = − −1 1 − ππ§ 1 − ππ§ −1 ROC Characteristic Finite-Duration Signal Infinite-Duration Signal (Causal) (Anti-Causal) (Two-Sided/Non-causal) Some Properties of z-Transform π§ Linearity: π₯ π = ππ₯1 π + ππ₯2 π Υ π π§ = ππ1 π§ + ππ2 (π§) Example: Find the z-transform for π₯ π = 10 4π − 17 9π π’[π] We get, π₯ π = 10 4π π’ π − 17 9π π’ π = 10π₯1 π − 17π₯2 [π] π π§ • π₯1 π = 4 π’ π Υ π1 π§ = π π§ 1 1−4π§ −1 1 ; π ππΆ: π§ > 4 • π₯2 π = 9 π’ π Υ π2 π§ = ; π ππΆ: π§ > 9 −1 1−9π§ 10 17 ∴π π§ = − ; π ππΆ: π§ > 9 −1 −1 1 − 4π§ 1 − 9π§ continued… π§ Time-Shifting: π¦ π = π₯ π − π Υ π π§ = π§ −π π(π§) Example: Using time-shifting, find z-transform for y1[n]=x[n+3] and y2[n]=x[n-2]; where x[n]=[ 2 0 5 4 6 3 ]. We get, π π§ = 2 + 5π§ −2 + 4π§ −3 + 6π§ −4 + 3π§ −5 ; π ππΆ: π§ > 0 • π1 π§ = π§ 3 π(π§) = 2π§ 3 + 5π§ + 4 + 6π§ −1 + 3π§ −2 ; π ππΆ: 0 < π§ < ∞ • π2 π§ = π§ −2 π(π§) = 2π§ −2 + 5π§ −4 + 4π§ −5 + 6π§ −6 + 3π§ −7 ; π ππΆ: π§ > 0 continued… π§ Scaling: If π₯ π Υ π π§ ; π ππΆ: π1 < π§ < π2 π§ π Then π π₯ π Υ π π−1 π§ ; π ππΆ: π π1 < π§ < π π2 π§ Time Reversal: If π₯ π Υ π π§ ; π ππΆ: π1 < π§ < π2 π§ Then π₯ −π Υ π π§ −1 ; π ππΆ: 1 π2 < π§ < Example: Determine the z-transform for x[n]=u[-n]. π§ Recall that, π’ π Υ 1 ; π ππΆ: π§ > 1 π§ 1 ∴ π’ −π Υ ; π ππΆ: π§ < 1 1−π§ 1−π§ −1 1 π1 continued… π§ Differentiation: π¦ π = ππ₯ π Υ π π§ = −π§ ππ π§ ππ§ ; π ππΆ π’ππβπππππ Example: Determine the z-transform for π¦ π = π 6π π’[π] We recall, π₯π π₯π ∴π¦ βΉπ π§ 1 = π π’ π Υπ π§ = ; π ππΆ: π§ > π −1 1 − ππ§ π§ 1 π = 6 π’ π Υπ π§ = ; π ππΆ: π§ > 6 −1 1 − 6π§ π§ ππ(π§) π = ππ₯ π Υ π π§ = −π§ ; π ππΆ: π§ > 6 ππ§ π 1 6π§ −1 = −π§ = ; π ππΆ: π§ > 6 −1 −1 2 ππ§ 1 − 6π§ 1 − 6π§ π π§ continued… π§ Convolution: π₯ π = π₯1 π ∗ π₯2 π Υ π π§ = π1 (π§)π2 (π§) Example: Using convolution property of z-transform, find π₯[π] = π₯1 [π] ∗ π₯2 [π], where x1=[ 5 0 7 ], x2=[ 2 4 ] • π1 π§ = 5 + 7π§ −2 ; π ππΆ: π§ > 0 • π2 π§ = 2 + 4π§ −1 ; π ππΆ: π§ > 0 ∴ π π§ = π1 (π§)π2 (π§) βΉ π π§ = 5 + 7π§ −2 2 + 4π§ −1 = 10 + 20π§ −1 + 14π§ −2 + 28π§ −3 ; π ππΆ: π§ > 0 ∴ π₯ π = [ 10 20 14 28 ] Poles & Zeros for Rational X(z) π π§ =π§ π−π π0 π§ − π§1 π§ − π§2 … π§ − π§π β π0 π§ − π1 π§ − π2 … π§ − ππ ο±The zeros of X(z) are the values of z for which π(π§) = 0 ο±The poles of X(z) are the values of z for which π(π§) = ∞ Note: • ROC of X(z) should not contain any poles. • If N > M, then X(z) has (N–M) zeros at origin. • If M > N, then X(z) has (M–N) poles at origin. • Poles or zeros may also occur at π§ = ∞ Example: Determine the pole-zero plot for the signal: π₯ π = 4π π’[π] We recall, 1 π π§ = ; π ππΆ: π§ > 4 −1 1 − 4π§ π§ βΉπ π§ = ; π ππΆ: π§ > 4 π§−4 X(z) has one zero at z=0 X(z) has one pole at z=4 Time-Domain Behavior with Pole Location “Causal Sequence π₯ π = ππ π’[π] ” Single Real Pole (Positive) 0<π<1 Single Real Pole (Negative) −1 < π < 0 π=1 π = −1 π>1 π < −1 Time-Domain Behavior with Pole Location “Causal Sequence π₯ π = πππ π’[π] ” Double Real Pole (Positive) 0<π<1 π=1 Double Real Pole (Negative) −1 < π < 0 π = −1 π < −1 π>1 continued… ο§ Causal real signals with simple real poles or simple complex conjugate pairs of poles, which are inside or on the unit circle, are always bounded in amplitude. ο§ Time behavior of a signal depends strongly on the location of its poles relative to the unit circle. ο§ Zeros also affect the behavior of a signal but not as strongly as poles. Some Common z-Transform Pairs x[n] X(z) ROC πΏ[π] 1 Entire z-plane π’[π] ππ π’[π] πππ π’[π] −ππ π’[−π − 1] −πππ π’[−π − 1] ππ cos ππ sin 1 1 − π§ −1 1 1 − ππ§ −1 ππ§ −1 1 − ππ§ −1 2 1 1 − ππ§ −1 ππ§ −1 1 − ππ§ −1 2 π§ >1 π§ > π π§ > π π§ < π π§ < π π0 π π’[π] 1 − ππ§ −1 cos π0 1 − 2ππ§ −1 cos π0 + π2 π§ −2 π§ > π π0 π π’[π] ππ§ −1 sin π0 1 − 2ππ§ −1 cos π0 + π2 π§ −2 π§ > π Inverse z-Transform 1 π₯π = ΰΆ» π(π§)π§ π−1 ππ§ 2ππ πΆ where C is a counterclockwise closed path encircling the origin and entirely in ROC. Methods: • Direct evaluation by contour integration • Expansion into a series of terms, in the variables π§ • Partial-fraction expansion and table lookup Example: Find the inverse z-transform for 1 4 π π§ = ; π ππΆ: π§ > 8 3 1 − 2π§ −1 + 9 π§ −2 We get, π π§ = ∴ π§2 π§ 2 − 2π§ + βΉπ π§ = 8 9 π§2 4 π§−3 2 π§−3 π π§ π§ βΉ = 4 2 π§ π§− π§− 3 3 π π§ π΄ π΅ βΉ = + 4 2 π§ π§−3 π§− 3 π§ 4 π§− 3 2 π§− 3 = π΄ 4 π§− 3 + π΅ π§− 2 3 2 4 βΉπ§=π΄ π§− +π΅ π§− 3 3 Putting π§ = 2Τ3 , we get π΅ = −1 Putting π§ = 4Τ3 , we get π΄ = 2 π π§ 2 −1 ∴ = + 4 2 π§ π§−3 π§− 3 2 1 βΉπ π§ = − 4 −1 2 −1 1− π§ 1 − π§ 3 3 continued… π π§ = 2 4 1−3π§ −1 − 1 2 1− π§ −1 3 ; π ππΆ: π§ > 4 3 ----------------(i) So, x[n] is causal, and both terms in eqn (i) are causal terms. π π 4 2 ∴π₯ π =2 π’π − π’[π] 3 3 2 • What if π ππΆ: π§ < ? 3 So, x[n] is anti-causal, and both terms in eqn (i) are anti-causal terms. π π 4 2 ∴ π₯ π = −2 π’ −π − 1 + π’[−π − 1] 3 3 continued… π π§ = 2 4 1−3π§ −1 − 1 2 1− π§ −1 3 ----------------(i) 2 4 3 3 • What if π ππΆ: < π§ < ? So, x[n] is two-sided, and one term in eqn (i) is causal, another is anti-causal. For ROC to exist (overlap): 2 ο§ π§ > provides causal part. 3 4 ο§ π§ < provides anti-causal part. 3 4 ∴ π₯ π = −2 3 π 2 π’ −π − 1 − 3 π π’[π] Example: Find the inverse z-transform for π π§ = 1+ π§ −1 1 1 − π§ −1 2 π π§ π§2 βΉ = π§ π§+1 π§−1 ; π₯ π ππ πππ’π ππ After solving, π΄ = 1Τ4 ; π΅ = 3Τ4 ; πΆ = 1Τ2 3ΰ΅ 1ΰ΅ 1ΰ΅ π π§ 4 + 4 + 2 ∴ = π§ π§+1 π§−1 π§−1 We get, π§3 π π§ = π§+1 π§−1 2 2 π π§ π΄ π΅ πΆ βΉ = + + π§ π§+1 π§−1 π§−1 2 π§2 π΄ π΅ πΆ ∴ = + + 2 π§+1 π§−1 π§+1 π§−1 π§−1 2 βΉ π§2 = π΄ π§ − 1 2 + π΅ π§ + 1 π§ − 1 + πΆ π§ + 1 2 3ΰ΅ 1ΰ΅ π§ −1 1ΰ΅ 4 + 4 + 2 βΉπ π§ = 1 + π§ −1 1 − π§ −1 1 − π§ −1 2 1 3 1 π π ∴ π₯ π = −1 π’ π + 1 π’ π + π 1 π π’[π] 4 4 2 1 βΉπ₯ π = −1 4 π 3 1 + + π π’[π] 4 2 Example: Find the inverse z-transform for 2π§ −1 π π§ = ; π₯ π ππ πππ’π ππ −1 −2 1 − 2π§ + 2π§ We get, π π§ = 2π§ π§ 2 −2π§+2 π π§ 2 βΉ = π§ π§− 1+π π§− 1−π π π§ π΄ π΄∗ βΉ = + π§ π§− 1+π π§− 1−π After solving, π΄ = −π; π΄∗ = π π π§ −π π ∴ = + π§ π§ − (1 + π) π§ − (1 − π) −π π βΉπ π§ = + −1 1 − (1 + π)π§ 1 − (1 − π)π§ −1 ∴ π₯ π = −π 1 + π π + π 1 − π π π’ π Formula: π΄ππ + π΄∗ π∗ π = 2 π΄ β π π cos ππ + π where π΄ = π΄ π ππ and π = π π ππ π π βΉ π₯ π = 2 2 cos π − π’[π] 4 2 π π ∴ π₯ π = 2 2 sin π π’[π] 4 π = −π = 1π −ππΤ2 π = 1 + π = 2π ππΤ4 Note: Here, π΄ System Function π»(π§) H(z) represents the z-domain characterization of a system, whereas h[n] is the corresponding time-domain characterization of the system. π§ π¦ π = π₯ π ∗ β π Υ π π§ = π π§ π»(π§) π(π§) π» π§ = π(π§) Example: Determine the system function and the impulse response of the causal 1 system described by the difference equation: π¦[π] = 5 π¦[π − 1] + 7π₯[π] Computing the z-transform of this difference equation, 1 −1 π π§ = π§ π π§ + 7π π§ 5 1 −1 βΉπ π§ 1− π§ = 7π π§ 5 π π§ 7 1 βΉπ» π§ = = ; π ππΆ: π§ > 1 π π§ 5 1 − π§ −1 5 π 1 ∴β π =7 π’[π] 5 Note: This system has pole at 1Τ5 and zero at origin. Example: An LTI system has β π = πΏ π + 0.5πΏ π − 1 . Find the system’s unit step response. We get, π» π§ = 1 + 0.5π§ −1 ; π ππΆ: π§ > 0 π§ And, π₯ π = π’ π Υ π π§ = 1 ; π ππΆ: π§ > 1 1 + 0.5π§ −1 ∴π π§ =π» π§ π π§ = 1 − π§ −1 1 0.5π§ −1 βΉπ π§ = + ; π ππΆ: π§ > 1 −1 −1 1−π§ 1−π§ ∴ π¦ π = π’ π + 0.5π’[π − 1] 1−π§ −1 Example: Compute the step response of a causal LTI system with zero at 1, pole at 3, and H(0) = 4. Also find the LCCDE. Let, π» π§ = π β π§−1 0−1 βΉπ» 0 =4=πβ βΉ π = 12 π§−3 0−3 π§−1 1 − π§ −1 ∴ π» π§ = 12 β = 12 β ; π ππΆ: π§ > 3 −1 π§−3 1 − 3π§ π§ And, π₯ π = π’ π Υ π π§ = 1 ; π ππΆ: π§ > 1 1 − π§ −1 1 12 ∴ π π§ = π» π§ π π§ = 12 β β = ; π ππΆ: π§ > 3 −1 −1 −1 1 − 3π§ 1−π§ 1 − 3π§ ∴ π¦ π = 12 3 π π’[π] π(π§) 1 − π§ −1 12 − 12π§ −1 = π» π§ = 12 β = −1 π(π§) 1 − 3π§ 1 − 3π§ −1 ∴ π¦ π − 3π¦ π − 1 = 12π₯ π − 12π₯[π − 1] 1−π§ −1 Causality & Stability with z-Transform • An LTI system is causal if and only if the ROC of H(z) is the exterior of a circle of radius π < ∞, including the point π§ = ∞. • An LTI system is BIBO stable if and only if the ROC of H(z) includes the unit circle. A causal LTI system is BIBO stable if and only if all the poles of H(z) are inside the unit circle. Example: An LTI system is characterized by the following system function: 1 π» π§ = 1 − 3.5π§ −1 + 1.5π§ −2 System is non-causal. Specify ROC of H(z). Determine h[n]. Find stability. After partial-fraction expansion, we get: 6ΰ΅ −1ΰ΅ 5 + 5 π» π§ = 1 −1 1 − 3π§ −1 1− π§ 2 Since the system is non-causal 1 (given), π ππΆ: 2 π 1 1 ∴β π =− 5 2 < π§ <3 6 π’ π − 3 π π’[−π − 1] 5 ROC contains “unit circle”, so the system is stable. continued… 6ΰ΅ −1ΰ΅ 5 + 5 π» π§ = 1 −1 1 − 3π§ −1 1− π§ 2 What if the system is causal? π ππΆ: π§ > 3 π 1 1 6 ∴β π =− π’ π + 3 π π’[π] 5 2 5 What if the system is anti-causal? 1 π ππΆ: π§ < 2 π 1 1 ∴β π = 5 2 6 π’ −π − 1 − 3 π π’[−π − 1] 5 ROC doesn’t contain “unit circle”, so ROC doesn’t contain “unit circle”, so the system is unstable. the system is unstable. Pole-Zero Cancellation When a z-transform has a pole that is at the same location as a zero, the pole is cancelled by the zero. οH(z) itself → order of the system reduced by one. οProduct of H(z) and X(z) → pole of the system suppressed by zero in x[n], or vice versa. By proper selection of the zeros of x[n], it is possible to suppress one or more system modes in the response of the system. By proper selection of the zeros of H(z), it is possible to suppress one or more modes of x[n] from the response of the system. Example: Find h[n] for a causal system is described by the following LCCDE: π¦ π = 2.5π¦ π − 1 − π¦ π − 2 + π₯ π − 5π₯ π − 1 + 6π₯[π − 2] We get, π¦ π − 2.5π¦ π − 1 + π¦ π − 2 = π₯ π − 5π₯ π − 1 + 6π₯[π − 2] Applying z-transform, π π§ − 2.5π§ −1 π π§ + π§ −2 π π§ = π π§ − 5π§ −1 π π§ + 6π§ −2 π(π§) βΉ π π§ 1 − 2.5π§ −1 + π§ −2 = π(π§) 1 − 5π§ −1 + 6π§ −2 π π§ 1 − 5π§ −1 + 6π§ −2 βΉπ» π§ = = π π§ 1 − 2.5π§ −1 + π§ −2 π§ 2 − 5π§ + 6 π§−2 π§−3 βΉ π»(π§) = 2 = π§ − 2.5π§ + 1 π§ − 2 π§ − 0.5 π§−3 π§ − 0.5 − 2.5 2.5 βΉπ» π§ = = =1− π§ − 0.5 π§ − 0.5 π§ − 0.5 2.5π§ −1 1 βΉπ» π§ =1− ; π ππΆ: π§ > −1 1 − 0.5π§ 2 ∴ β π = πΏ π − 2.5 0.5 π−1 π’[π − 1] Example: A causal LTI system is described by: 5 1 π¦ π = π¦ π − 1 − π¦ π − 2 + π₯[π] 6 6 Find the input signal that will cancel the nearest pole to the origin. Also find system response for that input. 5 −1 1 −2 π π§ 1− π§ + π§ = π(π§) 6 6 π(π§) 1 ∴π» π§ = = π(π§) 1 − 5 π§ −1 + 1 π§ −2 6 6 1 βΉπ» π§ = 1 1 1 − π§ −1 1 − π§ −1 2 3 This system has two real poles at 1Τ2 and 1Τ3 1 System π ππΆ: π§ > 2 The nearest pole is at 1Τ3 (to be cancelled). So, X(z) must be 1 −1 1 −3π§ ; ROC: π§ > 0 1 ∴ π₯ π = πΏ π − πΏ[π − 1] 3 1 1 Now, π π§ = π» π§ π π§ = 1 −1 ; π ππΆ: π§ > 2 1− π§ 2 1 ∴π¦π = 2 π π’[π] continued… • What if you want to cancel the farthest pole from the origin? 1 π» π§ = 1 −1 1 −1 1− π§ 1− π§ 2 3 The farthest pole is at 1Τ2 (to be cancelled). So, X(z) must be 1 − 1 −1 π§ 2 ; π ππΆ: π§ > 0 1 ∴ π₯ π = πΏ π − πΏ[π − 1] 2 1 1 Now, π π§ = π» π§ π π§ = 1 −1 ; π ππΆ: π§ > 3 1− π§ 3 1 ∴π¦ π = 3 π π’[π] Example: A cell phone signal π₯[π] is distorted by multipath reflections off of city buildings. What your cell phone receives is not π₯[π] but π¦[π], where π¦ π = π₯ π − 0.75π₯ π − 1 + 0.125π₯ π − 2 . Can you find a filter that recovers π₯[π] from π¦[π]? We need to compute the inverse filter π[π] that can undo the effect of β[π]. π(π§) π» π§ = = 1 − 0.75π§ −1 + 0.125π§ −2 π(π§) π§ 2 − 0.75π§ + 0.125 βΉπ» π§ = π§2 We want β[π] ∗ π[π] = πΏ[π], which implies π»(π§)πΊ(π§) = 1. 1 π§2 πΊ π§ = = 2 π»(π§) π§ − 0.75π§ + 0.125 continued… π§2 βΉπΊ π§ = π§ − 0.5 π§ − 0.25 πΊ π§ π§ βΉ = π§ π§ − 0.5 π§ − 0.25 πΊ π§ 2 −1 βΉ = + π§ π§ − 0.5 π§ − 0.25 2π§ π§ βΉπΊ π§ = − π§ − 0.5 π§ − 0.25 2 1 βΉπΊ π§ = − −1 1 − 0.5π§ 1 − 0.25π§ −1 ∴ π π = 2 0.5 π π’ π − 0.25 π π’[π] Digital Filter Use: • Signal separation EKG contaminated noise) • Signal restoration image captured shaky camera) (e.g. with (e.g. with Analog vs Digital • Analog filters are cheap, fast, and have a large dynamic range. • Digital filters are vastly superior in the level of performance. Digital Filter Type i. FIR Filter: has Finite Impulse Response [carried out by convolution] ii. IIR Filter: has Infinite Impulse Response [carried out by recursion] Filter Parameters Every linear filter has • impulse response • step response • frequency response Some info about dB: Every 20 dB means that the amplitude has changed by a factor of 10. -3 dB means that the amplitude is reduced to 0.707, and the power is reduced to 0.5. Information is Represented in Signals • Step response describes how information represented in the time domain is being modified by the system. • Frequency response shows how information represented in the frequency domain is being changed. Good performance in the time domain results in poor performance in the frequency domain, and vice versa. Example: Filter for noise removal from an EKG: step response is the important parameter, and frequency response is of little concern. Filter for a hearing aid: frequency response is all important, while step response doesn't matter. Time Domain Parameters of Digital Filter Better: οΌFast step response οΌNo overshoot οΌLinear Phase Frequency Domain Parameters of Digital Filter Better: οΌ Fast roll-off οΌ Flat passband οΌ Good stopband attenuation Low-Pass Filter to High-Pass Filter Band-Pass & Band-Reject Filter from LPF & HPF Moving Average Filter π−1 1 π¦ π = ΰ· π₯ π+π π π=0 For example, a 5-point MA filter: π₯ 80 + π₯ 81 + π₯ 82 + π₯ 83 + π₯[84] π¦ 80 = 5 π₯ 78 + π₯ 79 + π₯ 80 + π₯ 81 + π₯[82] Alternatively, π¦ 80 = 5 A 5-point filter has the filter kernel: [… 0 0 1 1 1 1 1 5 5 5 5 5 0 0…] That is, MA filter is a convolution of the input signal with a rectangular pulse having an area of unity. Remember: MA filter is an FIR filter. continued… The amount of noise reduction is equal to the square-root of the number of points in the average. For example, a 100 point moving average filter reduces the noise by a factor of 10. Frequency Response of MA Filter • MA is an exceptionally good smoothing filter. • But, MA is an exceptionally bad low-pass filter. Frequency response of an M-point MA filter: 1 sin πππ π»π = π sin ππ Windowed-Sinc Filter While this infinite length (in time domain) is not a problem for mathematics, it is a show stopper for computers. Now there is excessive ripple in the passband and poor attenuation in the stopband. Increasing the length of the filter kernel does not reduce these problems. continued… Windowing comes to the rescue! Multiplying the truncated-sinc (c), by the Blackman or Hamming window (e), results in the windowed-sinc filter kernel shown in (f). The passband is now flat, and the stopband attenuation is so good it cannot be seen in this graph. Window: Hamming vs Blackman • Hamming Window: π€ π = 0.54 − 0.46 cos 2ππ π • Blackman Window: π€ π = 0.42 − 0.5 cos 2ππ 4ππ + 0.08 cos π π Comparison: Hamming has about a 20% faster roll-off than Blackman. Blackman has a better stopband attenuation (−74 dB) than Hamming (−53 dB). Blackman has a passband ripple of about 0.02%, while Hamming is typically 0.2%. Conclusion: In general, Blackman should be your first choice; a slow roll-off is easier to handle than poor stopband attenuation. Designing the Windowed-Sinc Filter Parameters: οCutoff frequency, πC οLength of the filter kernel, π + 1 Value for π sets the roll-off: 4 π΅πtran ≈ π Both πC and π΅πtran are expressed as fraction of the sampling rate. Thus, they must be between 0 and 0.5. πC is measured at the one-half amplitude point. M=60 continued… Filter Kernel: (Blackman LPF) π π− 2 2ππ 4ππ β π = πΎ sinc 2ππC β 0.42 − 0.5 cos + 0.08 cos π π for 0 ≤ π ≤ π πΎ is chosen to provide unity gain at zero frequency (normalizing coefficient). π must be an even integer. Example: EEG pattern containing alpha rhythm occurs between 7 and 12 Hz, and beta rhythm occurs between 17 and 20 Hz. Design a Blackman LPF that can separate alpha from beta rhythms. The EEG signal was digitized at a sampling rate of 100 sample/second. Set your transition bandwidth at 4 Hz. Let, πC = 14 Hz = 0.14 of sampling rate. Given, π΅πtran = 4 Hz = 0.04 of sampling rate. 4 4 ∴π= = = 100 π΅πtran 0.04 β π = πΎ sinc 2ππC π π− 2 = πΎ sinc 0.28π π − 50 2ππ 4ππ β 0.42 − 0.5 cos + 0.08 cos π π 2ππ 4ππ β 0.42 − 0.5 cos + 0.08 cos 100 100 for 0 ≤ π ≤ 100 Kaiser Window πΏ = πππ πΏπ , πΏπ π΄ = −20 log10 πΏ 0.1102 π΄ − 8.7 , π΄ > 50 π½ = ΰ΅0.5842 π΄ − 21 0.4 + 0.07886 π΄ − 21 , 21 ≤ π΄ ≤ 50 0, π΄ < 21 π = even π΄−8 2.285 ππ − ππ • π + 1 is the length of the window. • π½ is the shape parameter. Large values of π½ result in reduced ripple. continued… πΌ0 π€π = π − 0.5π π½ 1− 0.5π 2 , 0≤π≤π πΌ0 (π½) James Frederick Kaiser 0, ππ‘βπππ€ππ π where πΌ0 β is the 0th-order modified Bessel function of the 1st kind, that can be easily generated using: π=∞ πΌ0 π₯ = 1 + ΰ· π=1 0.5π₯ π! π 2 οΌA Kaiser Window is nearly optimum in the sense of having the most energy in its main-lobe for a given side-lobe amplitude. Example: Design an FIR LPF using Kaiser window according to the following specifications 0.99 ≤ π» π ππ ≤ 1.01 0 ≤ π ≤ 0.19π π» π ππ ≤ 0.01 0.21π ≤ π ≤ π Solve: πΏ = πππ πΏπ , πΏπ = πππ 0.01,0.01 = 0.01 π΄ = −20 log10 πΏ = −20 log10 0.01 = 40 π½ = 0.5842 π΄ − 21 0.4 + 0.07886 π΄ − 21 = 0.5842 19 0.4 + 0.07886 19 βΉ π½ = 3.395 π΄−8 40 − 8 π = even = even 2.285 0.21π − 0.19π 2.285 ππ − ππ = even 222.8 = 224 continued… πΌ0 ∴π€ π = π − 0.5π π½ 1− 0.5π πΌ0 (π½) 0, 2 , 0≤π≤π ππ‘βπππ€ππ π πΌ0 0.0304 224π − π2 , 0 ≤ π ≤ 224 βΉπ€ π =ΰ΅ πΌ0 (3.395) 0, ππ‘βπππ€ππ π ∴ β π = βπ π β π€[π] where βπ [π] = πΎ sinc 0.2π π − 112 ππ + ππ 0.19π + 0.21π ππΆ = = 2 2 βΉ ππΆ = 0.2π IIR (Recursive) Filter π¦ π = π0 π₯ π + π1 π₯ π − 1 + π2 π₯ π − 2 + π3 π₯ π − 3 + β― +π1 π¦ π − 1 + π2 π¦ π − 2 + π3 π¦ π − 3 + β― π1 , π2 , π3 , … , π0 , π1 , π2 , π3 , … are called Recursion Coefficients. IIR filters execute very rapidly, but have less performance and flexibility than other digital filters. In theory, recursive filter convolves the input signal with a very long filter kernel; although only a few coefficients are involved. 3-stage Recursive Filter Single Pole Recursive Filter LPF HPF Proper coefficient selection can also make the digital recursive filter mimic an analog RC HPF or LPF. continued… Coefficient Selection: (Single Pole IIR Filter) οLPF: π0 = 1 − πΎ π1 = πΎ οHPF: 1+πΎ π0 = 2 1+πΎ π1 = − 2 π1 = πΎ • Physically, πΎ is the amount of decay between adjacent samples. • For example, πΎ = 0.87 means that the value of each sample in the output signal is 0.87 the value of the sample before it. • The higher the value of πΎ, the slower the decay. • 0<πΎ<1 • πΎ = π −2ππC , where πC = −3 dB cutoff frequency. continued… ο±Single Pole Recursive Filter in action: πΎ = 0.95 (for LPF), πΎ = 0.86 (for HPF) Remember: Single Pole Recursive Filter performs well in the time-domain, and poorly in the frequency-domain. Performance at higher πC (with respect to sampling rate) is terrible! Special: 4-stage Recursive LPF [comparable to the Blackman, but faster] Coefficient Selection: π0 = 1 − πΎ 4 π1 = 4πΎ π2 = −6πΎ 2 π3 = 4πΎ 3 π4 = −πΎ 4 where πΎ = π −14.445πC Narrow-band Filters Band-Pass Filter π0 = 1 − πΎ1 π1 = 2 πΎ1 − πΎ2 cos 2ππ π2 = πΎ2 2 − πΎ1 π1 = 2πΎ2 cos 2ππ where πΎ2 = 1 − 3 π΅π ; π2 = −πΎ2 2 1 − 2πΎ2 cos 2ππ + πΎ2 2 πΎ1 = 2 − 2 cos 2ππ π =center frequency π΅π =bandwidth measured at 0.707 amplitude [both expressed as fraction of sampling frequency] Band-Reject Filter π0 = πΎ1 π1 = −2πΎ1 cos 2ππ π2 = πΎ1 π1 = 2πΎ2 cos 2ππ π2 = −πΎ2 2 Phase Response • What is so wrong with nonlinear phase? Many applications cannot tolerate the left and right edges looking different. This can be misinterpreted as a feature (terrible)!!! • β[π] of recursive filter is not symmetrical between left and right, therefore has a nonlinear phase.