15 Oct 2009Comp30291 Section 21 UNIVERSITY of MANCHESTER School of Computer Science Comp30291: Digital Media Processing Section 2 Analogue filtering
15 Oct 2009Comp30291 Section 22 Analog system represented as ‘black box’ x(t)y(t) Inside we could have analogue components, or Analog lowpass filter 1 ADC Digital processor DAC Analog lowpass filter 2 x(t) y(t) Fs
15 Oct 2009Comp30291 Section 23 Analog low-pass filters Analog Lowpass Filter 1 is ‘antialiasing’ filter: removes any frequency components above Fs/2 before sampling process. Analog Lowpass Filter 2 is ‘reconstruction’ filter: smoothes DAC output to remove all frequency components above Fs/2. Digital processor controls ADC to sample at Fs Hz. Also sends output sample to DAC at Fs samples per second. DAC produces ‘staircase’ waveform: smoothed by ALpF2. DAC output t
15 Oct 2009Comp30291 Section 24 Analogue filters Still needed in the world of DSP Also, many digital filter designs are based on analog filters. They are ‘linear’ & ‘time-invariant’ (LTI) Analogue filter x(t) y(t)
15 Oct 2009Comp30291 Section 25 System is LINEAR if (1)for any signal x(t), if x(t) y(t) then a.x(t ) a.y(t) for any constant a. (2) for any signals x 1 (t) & x 2 (t), if x 1 (t) y 1 (t) & x 2 (t) y 2 (t) then x 1 (t) + x 2 (t) y 1 (t) + y 2 (t) (By x(t) y(t) we mean that applying x(t) to the input produces the output signal y(t). ) Definition of ‘linearity’
15 Oct 2009Comp30291 Section 26 Alternative definition of ‘linearity’ System is linear if for any signals x 1 (t) & x 2 (t), if x 1 (t) y 1 (t) & x 2 (t) y 2 (t) then a 1 x 1 (t) + a 2 x 2 (t) a 1 y 1 (t) +a 2 y 2 (t) for any a 1 & a 2
15 Oct 2009Comp30291 Section 27 Linearity (illustration) Linear system If x 1 (t) y 1 (t) & x 2 (t) y 2 (t) then 3x 1 (t)+4x 2 (t) 3y 1 (t)+4y 2 (t) t x 2 (t) t y 2 (t) x 1 (t) t t y 1 (t) + +
15 Oct 2009Comp30291 Section 28 Definition of ‘time-invariance’ A time-invariant system must satisfy: For any x(t), if x(t) y(t) then x(t- ) y 1 (t- ) for any Delaying input by seconds delays output by seconds Not all systems have this property. An LTI system is linear & time invariant. An analogue filter is LTI.
15 Oct 2009Comp30291 Section 29 a 0 + a 1 s + a 2 s a N s N H(s) = b 0 + b 1 s + b 2 s b M s M ‘System function’ for analogue LTI circuits An analog LTI system has a system (or transfer) function Coeffs a 0, a 1,...,a N, b 0,..., b M determine its behaviour. Designer of analog lowpass filters must choose these carefully. H(s) may be evaluated for complex values of s. Setting s = j where = 2 f gives a complex function of f. Modulus |H(j )| is gain at radians/second ( /2 Hz) Argument of H(j ) is phase-lead at radians/s.
15 Oct 2009Comp30291 Section 210 Gain & phase response graphs G( Gain: G( ) = |H(j )| Phase lead: ( ) = Arg[H(j )| -()-() Gain Phase-lag f / (2 )
15 Oct 2009Comp30291 Section 211 It may be shown that: when input x(t) = A cos( t), output y(t) = A. G( ). cos( t + ( ) ) Output is sinusoid of same frequency as input. ‘Sine-wave in sine-wave out’ Multiplied in amplitude by G( ) & ‘phase-shifted’ by ( ). Example: If G( ) = 3 and ( ) = /2 for all what is the output? Answer: y(t) = 3.A.cos( t + /2) = 3.A.sin ( t) Effect of phase-response
15 Oct 2009Comp30291 Section 212 Express y(t) = A. G( ). cos( t + ( ) ) as A. G( ). cos ( [t + ( )/ ]) = A. G( ). cos( [t - ( )] ) where ( ) = - ( )/ Cosine wave is delayed by - ( )/ seconds. - ( )/ is ‘phase-delay’ in seconds Easier to understand than ‘phase-shift’ Phase-shift expressed as a delay
15 Oct 2009Comp30291 Section 213 If - ( )/ is constant for all , all frequencies delayed by same time. Then system is ‘linear phase’ - this is good. Avoids changes in wave-shape due to ‘phase distortion’; i.e different frequencies being delayed by differently. Not all LTI systems are ‘linear phase’. Linear phase
15 Oct 2009Comp30291 Section 214 Linear phase response graph
15 Oct 2009Comp30291 Section 215 Low-pass analog filters Would like ideal ‘brick-wall’ gain response & linear phase response as shown below: ( ) G( ) 1 0 CC C = cut-off frequency
15 Oct 2009Comp30291 Section 216 Butterworth low-pass gain response Cannot realise ideal ‘brick-wall’ gain response nor linear phase. Can realise Butterworth approximation of order n: Properties (i) G(0) = 1 ( 0 dB gain at =0) (ii) G( C ) = 1/( 2) ( -3dB gain at = C )
15 Oct 2009Comp30291 Section 217 Examples of Butterwth low-pass gain responses Let C = 100 radians/second. G( C ) is always 1/ (2) Shape gets closer to ideal ‘brick-wall’ response as n increases.
15 Oct 2009Comp30291 Section radians/second G( ) n = 2 n=4 n=7 1 / (2) LINEAR-LINEAR PLOT
15 Oct 2009Comp30291 Section 219 Butterworth gain responses on dB scale Plot G( ) in dB, i.e. 20 log 10 (G( )), against . With on linear or log scale. As 20 log 10 (1/ (2)) = -3, all curves are -3dB when = C
15 Oct 2009Comp30291 Section dB radians/second -3dB dB-LINEAR PLOT n=2 n=4 n=7
15 Oct 2009Comp30291 Section dB radians/second dB-LOG PLOT n=2 n=4 3 dB
15 Oct 2009Comp30291 Section 222 clear all; for w = 1 : 400 G2(w) = 1/sqrt(1+(w/100)^4); G4(w) = 1/sqrt(1+(w/100)^8) ; G7(w) = 1/sqrt(1+ (w/100)^14); end; plot([1:400],G2,'r',[1:400],G4,'b',[1:400],G7,'k'); grid on; DG2=20*log10(G2); DG4=20*log10(G4); DG7=20*log10(G7); plot([1:400],DG2,'r',[1:400],DG4,'b',[1:400],DG7,'k'); grid on; semilogx([1:990], DG2,'r', [1:990], DG4, 'b’); MATLAB program to plot these graphs
15 Oct 2009Comp30291 Section 223 ‘Cut-off’ rate Best seen on a dB-Log plot Cut-off rate is 20n dB per decade or 6n dB per octave at frequencies much greater than C. Decade is a multiplication of frequency by 10. Octave is a multiplication of frequency by 2. So for n=4, gain drops by 80 dB if frequency is multiplied by 10 or by 24 dB if frequency is doubled.
15 Oct 2009Comp30291 Section 224 G( ) 1 CC Low-pass with C = 1 Low-pass G( ) 1 1 radian/s Ideal Approximatn Filter types - low-pass
15 Oct 2009Comp30291 Section 225 G( ) 1 G( ) 1 CC LL UU High-pass Band-pass Filter types - high-pass & band-pass
15 Oct 2009Comp30291 Section 226 G( ) 1 LL UU Filter types - band-stop
15 Oct 2009Comp30291 Section 227 G( ) 1 LL UU Narrow-band ( U < 2 L ) Broad-band ( U > 2 L ) Two types of band-pass gain-responses LL UU G( ) 1
15 Oct 2009Comp30291 Section 228 G( ) 1 LL UU Narrow-band ( U < 2 L ) Broad-band ( U > 2 L ) Three types of ‘band-stop’ gain-responses LL UU G( ) 1
15 Oct 2009Comp30291 Section 229 G( ) 1 NN Notch All-pass Third type of ‘band-stop’ gain-response Yet another type of gain-response G( ) 1
15 Oct 2009Comp30291 Section 230 Approximatns for high-pass, band-pass etc Fortunately these can be derived from the formula for a Butterworth LOW-PASS gain response. MATLAB does all the calculations.
15 Oct 2009Comp30291 Section 231 A filter which uses a Butterworth gain-response approximation of order n is an ‘nth order Butterworth type filter’. In addition to Butterworth we have other approximations Chebychev (types 1 & 2) Elliptical Bessel, etc. Other approximations
15 Oct 2009Comp30291 Section 232 Problems 1. An analog filter has: H(s) = 1 / (1 + s) Give its gain & phase responses & its phase delay at = Use MATLAB to plot gain response of Butterwth type analog low-pass filter of order 4 with C = 100 radians/second. Solution to (2):- for w = 1 : 400 G(w) = 1/sqrt(1+(w/100)^8) ; end; plot(G); grid on;
15 Oct 2009Comp30291 Section 233 Result obtained:-