Analogue filtering UNIVERSITY of MANCHESTER School of Computer Science 11/16/2018 UNIVERSITY of MANCHESTER School of Computer Science Comp30291: Digital Media Processing 2008-9 Section 2 Analogue filtering 4 Oct 2008 Comp30291 Section 2 Comp30291 - Oct'08
Analog system represented as ‘black box’ x(t) y(t) Inside we could have analogue components, or Digital processor Analog lowpass filter 1 x(t) Analog lowpass filter 2 ADC y(t) DAC Fs Fs 4 Oct 2008 Comp30291 Section 2
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 4 Oct 2008 Comp30291 Section 2
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) 4 Oct 2008 Comp30291 Section 2
Definition of ‘linearity’ System is LINEAR if 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 x1(t) & x2(t), if x1(t) y1(t) & x2(t) y2(t) then x1(t) + x2(t) y1(t) + y2(t) (By x(t) y(t) we mean that applying x(t) to the input produces the output signal y(t). ) 4 Oct 2008 Comp30291 Section 2
Alternative definition of ‘linearity’ System is linear if for any signals x1(t) & x2(t), if x1(t) y1(t) & x2(t) y2(t) then a1x1(t) + a2 x2(t) a1y1(t) +a2 y2(t) for any a1 & a2 4 Oct 2008 Comp30291 Section 2
Linearity (illustration) system If x1(t) y1(t) & x2(t) y2(t) then 3x1(t)+4x2(t) 3y1(t)+4y2(t) t x2(t) y2(t) x1(t) y1(t) + 4 Oct 2008 Comp30291 Section 2
Definition of ‘time-invariance’ A time-invariant system must satisfy: For any x(t), if x(t) y(t) then x(t-) y1(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. 4 Oct 2008 Comp30291 Section 2
‘System function’ for analogue LTI circuits An analog LTI system has a system (or transfer) function a0 + a1s + a2s2 + ... + aNsN H(s) = b0 + b1s + b2s2 + ... + bMsM Coeffs a0, a1, ...,aN, b0, ..., bM 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 = 2f 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. 4 Oct 2008 Comp30291 Section 2
Gain & phase response graphs Gain: G() = |H(j)| Phase lead: () = Arg[H(j)| -() G(w) Gain Phase-lag f / (2) 4 Oct 2008 Comp30291 Section 2
Effect of phase-response 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) 4 Oct 2008 Comp30291 Section 2
Phase-shift expressed as a delay 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’ 4 Oct 2008 Comp30291 Section 2
Linear phase 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’. 4 Oct 2008 Comp30291 Section 2
Linear phase response graph 4 Oct 2008 Comp30291 Section 2
Low-pass analog filters Would like ideal ‘brick-wall’ gain response & linear phase response as shown below: () G() 1 C C = cut-off frequency 4 Oct 2008 Comp30291 Section 2
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) 4 Oct 2008 Comp30291 Section 2
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. 4 Oct 2008 Comp30291 Section 2
n=7 n = 2 n=4 LINEAR-LINEAR PLOT G() 1 / (2) radians/second 1 0.9 0.8 1 / (2) 0.7 0.6 0.5 0.4 0.3 0.2 n=7 n=4 n = 2 0.1 50 100 150 200 250 300 350 400 radians/second 4 Oct 2008 Comp30291 Section 2
Butterworth gain responses on dB scale Plot G() in dB, i.e. 20 log10(G()), against . With on linear or log scale. As 20 log10(1/(2)) = -3, all curves are -3dB when = C 4 Oct 2008 Comp30291 Section 2
dB-LINEAR PLOT dB -10 n=2 -20 -30 n=4 -3dB -40 -50 -60 n=7 -70 -80 -90 dB -10 n=2 -20 -30 n=4 -3dB -40 -50 -60 n=7 -70 -80 -90 50 100 150 200 250 300 350 400 radians/second 4 Oct 2008 Comp30291 Section 2
dB-LOG PLOT dB 3 dB n=2 n=4 radians/second -10 -20 -30 -40 -50 -60 dB -10 3 dB -20 -30 n=2 -40 -50 -60 n=4 -70 -80 1 2 3 10 10 10 10 radians/second 4 Oct 2008 Comp30291 Section 2
MATLAB program to plot these graphs 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’); 4 Oct 2008 Comp30291 Section 2
‘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. 4 Oct 2008 Comp30291 Section 2
Filter types - low-pass G() 1 1 radian/s Ideal Approximatn Low-pass with C = 1 G() 1 C Low-pass 4 Oct 2008 Comp30291 Section 2
Filter types - high-pass & band-pass 1 High-pass C G() 1 Band-pass L U 4 Oct 2008 Comp30291 Section 2
Filter types - band-stop G() 1 L U 4 Oct 2008 Comp30291 Section 2
Two types of band-pass gain-responses 1 Narrow-band (U < 2 L ) L U G() 1 Broad-band (U > 2 L ) L U 4 Oct 2008 Comp30291 Section 2
Three types of ‘band-stop’ gain-responses 1 Narrow-band (U < 2 L ) L U G() 1 Broad-band (U > 2 L ) L U 4 Oct 2008 Comp30291 Section 2
Third type of ‘band-stop’ gain-response 1 Notch N Yet another type of gain-response G() 1 All-pass 4 Oct 2008 Comp30291 Section 2
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. 4 Oct 2008 Comp30291 Section 2
Other approximations 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. 4 Oct 2008 Comp30291 Section 2
Problems 1. An analog filter has: H(s) = 1 / (1 + s) Give its gain & phase responses & its phase delay at = 1. 2. 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; 4 Oct 2008 Comp30291 Section 2
Result obtained:- 4 Oct 2008 Comp30291 Section 2