Systems: Definition x[n] y[n] S A system is a transformation from an input signal . x[n] into an output signal y[n] Example: a filter SIGNAL s[n] NOISE x[n] v[n] y[n] s[n] Filter Systems and Properties: Linearity Linearity: x1[n] S y1[n] x2 [ n ] S y 2 [ n] x[n] a1 x1[n] a2 x2 [n] S y[n] a1 y1[n] a2 y2[n] Systems and Properties: Time Invariance if x[n] S y[n] time time y[n D] x[n D] then D time S D time Systems and Properties: Stability Bounded Output Bounded Input x[n] y[n] S Systems and Properties: Causality x[n] y[n] S the effect comes after the cause. Examples: y[n] 3x[n 1] 2 x[n 2] 4 x[n 3] y[n] 3x[n 1] 2 x[n 2] 4 x[n 3] Causal Non Causal Finite Impulse Response (FIR) Filters x[n] Filter y[n] General response of a Linear Filter is Convolution: N y[n] h[n] * x[n] h[]x[n ] 0 Written more explicitly: y[n] h[0]x[n] h[1]x[n 1] ... h[ N ]x[n N ] Filter Coefficients Example: Simple Averaging x[n] Filter y[n] 1 y[n] x[n] x[n 1] ... x[n 9] 10 Each sample of the output is the average of the last ten samples of the input. It reduces the effect of noise by averaging. FIR Filter Response to an Exponential Let the input be a complex exponential x[n] e j0n Then the output is N y[n] h[]e j0 ( n ) 0 N j0 ) j0 n h[]e e 0 x[n] e j0n Filter y[n] H 0 e j0n Example x[n] e j0n Filter y[n] H 0 e j0 n Consider the filter 1 y[n] x[n] x[n 1] ... x[n 9] 10 j 0.1n with input Then x[n] e 1 9 j 0.1 1 1 e j 0.1 10 j1.4137 H 0.1 e 0 . 6392 e j 0.1 10 0 10 1 e and the output y[n] 0.6392e j1.4137 e j 0.1 n Frequency Response of an FIR Filter x[n] e j0n Filter N H ( ) h[n]e jn y[n] H 0 e j0n n 0 is the Frequency Response of the Filter Significance of the Frequency Response If the input signal is a sum of complex exponentials… x[n] X k e jk n Filter y[n] Yk e k jk n k … the output is a sum is a sum of complex exponential. Each coefficient is multiplied by the corresponding frequency response: Xk Yk H (k ) X k Example Consider the Filter x[n] defined as y[n] Filter 1 y[n] x[n] x[n 1] ... x[n 4] 5 Let the input be: x[n] 3 cos(0.1 n 0.2) 2 cos(0.3 n 0.7) Expand in terms of complex exponentials: e 1.0e e x[n] 1.5e j 0.2 e j 0.1 n 1.5e j 0.2 e j 0.1 n j 0.7 j 0.3 n 1.0e j 0.7 j 0.3 n Example (continued) The frequency response of the filter is (use geometric sum) j 5 1 1 1 e j j 4 H ( ) 1 e ... e j 5 5 1 e Then e H 0.2 1.0e e y[n] H 0.1 1.5e j 0.2 e j 0.1 n H 0.1 1.5e j 0.2 e j 0.1 n j 0.7 j 0.3 n H 0.2 1.0e j 0.7 j 0.3 n with H (0.1 ) 0.904e j 0.6283 , H (0.1 ) 0.904e j 0.6283 H (0.2 ) 0.647e j1.2566 , H (0.1 ) 0.647e j1.2566 Just do the algebra to obtain: y[n] 2.712cos(0.1 n 0.428) 1.294cos(0.3 n 1.956) The Discrete Time Fourier Transform (DTFT) Given a signal of infinite duration x[n] with n define the DTFT and the Inverse DTFT X ( ) DTFTx[n] j n x [ n ] e n 1 x[n] IDTFTX ( ) 2 Periodic with period 2 jn X ( ) e d X ( 2 ) X ( ) General Frequency Spectrum for a Discrete Time Signal Since X ( ) is periodic we consider only the frequencies in the interval | X () | FS 2 0 0 (rad ) F F (Hz) S 2 * X ( ) X () If the signal x[n] is real, then Example: DTFT of a rectangular pulse … Consider a rectangular pulse of length N x[n] 1 0 Then where N 1 N 1 X ( ) e j n n 0 WN ( ) e n 1 e j N WN ( ) j 1 e j ( N 1) / 2 sin N / 2 sin / 2 Example of DTFT (continued) x[n] 1 n N 1 0 DTFT WN () 12 N 10 8 6 4 2 0 -3 -2 -1 2 N 0 1 2 N 2 3 Why this is Important x[n] y[n] Filter Recall from the DTFT 1 x[ n] 2 j n X ( ) e d Then the output 1 jn y[n] X ( ) H ( ) e d 2 Which Implies Y () DTFTy[n] H () X () Summary Linear FIR Filter and Freq. Resp. x[n] y[n] Filter N 1 Filter Definition: y[n] h[n] * x[n] h[]x[n ] 0 N 1 jn H ( ) h [ n ] e , Frequency Response: n 0 DTFT of output Y ( ) H ( ) X ( ) Frequency Response of the Filter x[n] Filter y[n] Frequency Response: N 1 H ( ) h[n]e jn , n 0 We can plot it as magnitude and phase. Usually the magnitude is in dB’s and the phase in radians. Example of Frequency Response Again consider FIR Filter 1 y[n] x[n] x[n 1] ... x[n 9] 10 The impulse response can be represented as a vector of length 10 h 0.1, 0.1 ... 0.1 Then use “freqz” in matlab freqz(h,1) to obtain the plot of magnitude and phase. Example of Frequency Response (continued) Magnitude (dB) 0 -20 -40 -60 -80 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1 Phase (degrees) 100 0 -100 -200