Ideal Lowpass Filter (LPF) where Ωc is the cutoff frequency. What is the impulse response of ideal LPF? Ideal HPF where Ωc is the cutoff frequency. What is the impulse response? Ideal BPF where Ωc1 and Ωc2 are the cutoff frequencies. Ideal BSF where Ωc1 and Ωc2 are the cutoff frequencies. FIR Filter FIR: finite impulse response (the impulse response function has a finite length). Ex: Always stable since Long length FIR filter needs lots of delayers. IIR Filter IIR: infinite impulse response (the impulse response function has infinite length). Ex: May have stability issue. Implemented using feedback loop. (You don not need infinite number of delayers!) Distortionless transmission -- Phase Phase response of ideal filter was assumed to be zero. Ideal filter is physically impossible. In practice, linear phase within passband can achieve distortionless transmission. Ex: For a signal with 3 tones: the following practical filter is applied: To look at the output y[k] from the filter, we need t know the response at each individual frequencies: where m1, m2, m3 are the slopes of the phase response. From previous figure, output is Do you see any problem at y[k]? If m1≠m2, the output signal y[k] have different phase delays at different frequencies! What does thin mean? signal is distorted! 2 2 1.5 1.5 1 1 0.5 0.5 0 0 -0.5 -0.5 -1 -1 -1.5 -1.5 -2 -2 0 50 100 150 time 200 250 0 50 100 150 time 200 250 Linear phase FIR For N-tap FIR with If the impulse response satisfies: Symmetrical: or antisymetrical: then the frequency response is: Linear phase FIR types Example of FIR with linear and nonlinear phase Example LPF H ( z ) 1 2 z 1 3z 2 2 z 3 z 4 Linear Phase H H 9 0.5 0 0.5 0 .5 0 .5 0 0 .5 0 .5 0 H ( z ) 1 2 z 1 3z 2 2 z 3 z 4 Non-linear Phase H H 7 0.5 0 0.5 0 .5 0 0 .5 0 .5 0 0 .5 Ideal v.s. non-ideal filter Ex: Ideal LPF with linear phase: Clearly, this IRF has infinite length and is non-causal. IRF of the ideal LPF: Truncate the IRF to obtain 2 practical implementations: 141-tap 21-tap Inverse FT of the two implementation IRF to obtain TF: Both H1 and H2 are not exactly the ideal LPF. 2. H1 with 141-tap is closer to ILP. H2 with 21-tap shows more oscillation. 1. Practical LPF Practical filters don’t have a ‘sharp’ cutoff. They may also oscillate. Ideal filters are non-causal, and cannot be implemented. When the Ideal filter impulse response is truncated, FIR filter results. The pass band gain is not constant - includes several oscillating ripples, referred to as the pass-band ripples. The stop band gain is not zero – again it includes ripples, referred to as the stop band ripples. If FIR filter length is small: More ripples, higher transition bandwidth. Low cost, smaller delay If FIR filter length is large: Less ripples, lower transition bandwidth. Higher cost, larger delay. Example Impulse response of a 21-tap FIR filter is given. Estimate stopband ripple and transitionband bandwidth. Frequency response: >> MATLAB Code for plotting the frequency response >> h = [-0.0014 0.0015 0.0066 0.0081 -0.0059 -0.0330 -0.0411 0.0121 0.1320 0.2619 0.3183 0.2619 0.1320 0.0121 -0.0411 -0.0330 -0.0059 0.0081 0.0066 0.0015 -0.0014] ; >> stem(k,h,'filled') >> % Calculating the frequency response >> [H, w] = freqz(h,1) ; >> plot(w,20*log10(abs(H))), grid >> plot(w,angle(H)), grid h[k ] 3 6 14 15 16 7 8 9 10 11 12 13 k 17 18 19 20 20 log 10 H 0 20 40 60 0 .5 0 0 .5 Generic filters Any linear diff. eq. can be iteratively solved to obtain: Filter realization involves: shifting, adder, and multiplication. Hardware to construct digital filter Delayer: Adder: Constant multiplier: FIR Direct form: N-th order FIR needs (N-1) delayers. Cascade: factorizing TF into multiplication of quadratic terms. N-th order FIR needs (N-1) delayers. Linear phase FIR: Symmetry! N is even: N is odd: (N-1) delayers. Transposed form: Cascade filter: input output; reverse flow direction; source node adder; Reorder the diagram. IIR Direct form I: when the numerator and denominator of the TF are, Direct form II: Interchange the order of N(z) and D(z) from direct form I; Delayers are merged. Cascade form: factorize N(z) and D(z) into quadratic terms Q(z) here is from the terms that can’t be factorized as shown previously (for M≠N ). Parallel form: (expressed as quadratic term to prevent complex coefficients.) Choice of structures The direct form II (also parallel and cascaded form) is the so called canonical form and is often used due to simplicity. The outputs from all forms should be the same for the same input. However, due to the finite precision (word length) of the coefficients, the results may vary. Matlab function filterbuilder() provides the coefficients of all forms. And already considered the finite precision effect.