Sept'05CS32911 CS3291 Sect 2: Review of analogue systems Example of an analogue system: Represent as “black box” R C y(t) x(t) y(t)
Sept'05CS32912 Linearity: (1)for any x(t), if x(t) y(t) then ax(t ) ay(t) (2) for any 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)
Sept'05CS32913 Linearity: alternative definition For any 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
Sept'05CS32914
Sept'05CS32915 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.
Sept'05CS32916 Ex 2.1: Is it true that for all LTI systems, output has same shape as input? Answer: nope
Sept'05CS Unit impulse:
Sept'05CS32918 Fundamental properties of unit impulse :
Sept'05CS32919 Sampling property of impulse
Sept'05CS Proof of sampling property x( ) (t- ) = 0 except at = t. x( ) (t- ) = x(t) (t- ). It follows that:
Sept'05CS Impulse-response: (t) h(t) Impulse-response of RC circuit in Fig. 2.1 is: 0 : t < 0 h(t) = (1/RC)e - t / R C : t 0
Sept'05CS /RC t h(t) Impulse-response of RC circuit. See Appendix A for proof.
Sept'05CS Convolution x(t) y(t) LTI h(t ) x(t) h(t)
Sept'05CS Proof of formula for convolution: (t) h(t) (t- ) h(t- ) (by time-invariance) x( ) (t- ) x( )h(t- ) (by linearity) x(t) x(t) h(t) (by sampling property (convolution)
Sept'05CS Ex 2.3: An LTI system has t h(t) 1 1 Calculate its response to sin( t) Solution:
Sept'05CS : Properties of analogue LTI systems Stability: An LTI system is stable if h(t), satisfies: |h(t)| dt < . - Causality: An LTI system is causal if h(t), satisfies: h(t) = 0 for t < 0 (No crystal ball!)
Sept'05CS329117
Sept'05CS Consider response to x(t) = cos( t) + j sin( t) = e j t Frequency response: Fourier transform of h(t). Complex number for any .
Sept'05CS G( ) = H(j ) is "gain response, ( ) = Arg{H(j )} is the "phase response". Therefore: H(j ) = G( )e j ( ) As h(t) is real, H(-j ) is complex conjugate of H(j ).
Sept'05CS Let input be A cos( t) = real part of A e j t We know that e j t e j t H(j ), Response to A cos( t) will be: A. RE { e j t H(j ) } = A. RE { e j t G( ) e j ( ) } = A. G( ). RE { e j ( t + ( ) ) } = A. G( ). cos( t + ( ) ) = A. G( ). cos( (t - ) ) where = - ( )/
Sept'05CS Gain & phase response graphs G(
Sept'05CS Linear phase
Sept'05CS Phase-response (cont) Meaning of phase-response not as obvious as ‘gain response’: ( ) / is ‘phase delay’ in seconds Ideal is to have same delay at all frequencies: linear phase. True if - ( ) = T S for all , where T S constant. All components of a Fourier series delayed by same time T S. Avoids changes in wave-shape due to ‘phase distortion’; i.e different frequencies being delayed by differently. Ear not very sensitive to phase distortion on normal telephones. Quite different wave-shapes can sound the same. But phase distortion of digital transmissions can be serious.
Sept'05CS : Inverse Fourier Transform: : 1 h(t) = H(j ) e j t d 2 - There are some interesting things to notice:- (1). Range of integration is - to . (2). Differences between this formula & “forward” FT: (i) the (1/2 ) factor (ii) sign of j t ( + for inverse, - for forward) (iii) variable of integration is d for inverse transform & dt for forward.
Sept'05CS Replacing s by j gives H(s) = H(j ) = freq-resp = Fourier transform of h(t). Fourier transform = Laplace transform with s = j . 2.7 Laplace transform Given analogue LTI system with impulse-response h(t). Response to x(t) = e st where s = + j is H(s) is "bilateral Laplace transform" of h(t). For causal system, H(s) becomes normal Laplace transform
Sept'05CS For causal stable LTI system,... H(s) is finite for any s with real part 0. H(s) cannot be infinite for values of s with real part 0 Proof: Consider |H(s)| for some value of s = + j with > 0:
Sept'05CS If x(t) = e st then y(t) = H(s)e st. Also dx(t)/dt = se st, d 2 x(t)/dt 2 = s 2 e s t, dy(t)/dt = sH(s)e st etc. H(s)e st (b 0 +b 1 s+b 2 s b M s M ) = e st (a 0 + a 1 s + a 2 s a N s N ) i.e. 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 2.8. ‘System function’ for analogue LTI circuits: Relationship between input x(t) & output y(t):
Sept'05CS Poles & zeros of H(s): Factorise numerator & denom of H(s) to obtain: (s-z 1 )(s-z 2 ).... (s-z N ) H(s) = K (s-p 1 )(s-p 2 ).... (s-p M ) Poles: p 1, p 2,.... p M. Zeros: z 1, z 2,.... z N. H(s) normally zero at a zero infinite at a pole. For real system, poles & zeros real or in complex conj. pairs. Since H(s) must be finite for all s with real part 0, for causal stable system, no pole can have real part 0. On Argand diag, no poles can be on RHS or on imaginary axis. Poles are restricted to LHS. No such restrictions on zeros.
Sept'05CS Real Part Imaginary part Poles must be on left of imag axis. Zeros can be anywhere Zero Pole Poles & zeros on real axis or in complex conjugate pairs Pole
Sept'05CS Design of analogue filters Two stages given a frequency response specification: 1) Find realisable H(s) which approximates the specification: 2) Find circuit to realise H(s): Many design techniques for digital filters use the same approximations as are used for analogue filters. It is useful to review one of these.
Sept'05CS Approximation stage for a low-pass analog filter: Ideal "brick-wall" gain response & linear phase response i.e ( ) = arg(H(j )) = -k ( ) G( ) 1 0 CC
Sept'05CS Need expressions for G( ) & ( ) which are approximations to the ideal specification. Must correspond to the H(s) of a realisable circuit whose order is practically manageable. Concentrate on G( ) first. Consider Butterworth approximation of order n: Properties (i) G(0) = 1 ( 0 dB gain at =0) (ii) G( C ) = 1/( 2) ( -3dB gain at = C ) (iii) When >> C, G( ) ( C / ) n (iv) G( ) is maximally flat at = 0 & at = .
Sept'05CS Examples of Butterwth low-pass gain responses Let C = 100 radians/second & n = 2, 4, & 7. G( C ) is always 1/ (2) Shape gets closer to ideal ‘brick-wall’ response as n increases. Common to 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.
Sept'05CS radians/second G( ) n = 2 n=4 n=7 1 / (2) LINEAR-LINEAR PLOT
Sept'05CS dB radians/second -3dB dB-LINEAR PLOT n=2 n=4 n=7
Sept'05CS dB radians/second dB-LOG PLOT n=2 n=4 3 dB
Sept'05CS 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’);
Sept'05CS ‘ Cut-off’ rate This is best seen on a dB-Log plot By property (iii), 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 id doubled.
Sept'05CS H(s) for nth order Butterworth low-pass approxn: 1 H(s) = [n/2] (1+s/ C ) P {1 + 2sin[(2k-1) /2n]s/ C + (s/ C ) 2 } k=1 [n/2] is integer part of n/2, P=0 / 1 for n even/odd. sign means ‘product’. Denominator is product of 1st & 2nd order polynomials in s. H(s) is often realised by analogue circuits. Can also be realised by IIR digital filters.
Sept'05CS Examples
Sept'05CS More Examples … and if C 1 replace ‘s’ by ‘s / C ’ in formula Not easy to show that replacing s by j & taking modulus gives appropriate Butterwth G( ). But it’s true!
Sept'05CS Frequency-band transformations: Given H(s) for low-pass approxn with C =1 (pass-band -1 1), we can produce the transfer functns of other useful approxns: Low-pass: s s/ C Scales cut-off from1 to C. High-pass: s C /s H( C /s) is high-pass with cut-off C Band-pass: s (s+p/s)/d where d = U - L & p = U L. Produces band-pass transfer function with cut-off U & L. Band-stop : s d/(s+p/s) where d= U - L & p= U L
Sept'05CS Examples: use of freq band transformations 1. Transform the 1st order Butterwth low-pass system function with 3 dB cut-off 1 radian/second: H(s) = 1 / (1+s) into a high-pass system fn with cut-off C 2. Transform H(s) = 1/(1+s) into a band-pass (narrow-band) transfer fn with cut-off frequencies: L = 2, U = Transform H(s) = 1/(1+s) into a band-stop (narrow-band) transfer fn with cut-off frequencies: L = 2, U = Transform H(s) = 1/(1+s) to band-pass (broad-band) transfer fn with cut-off frequencies: L = 2, U = 9
Sept'05CS G( ) 1 G( ) 1 CC 1 radian/s Low-pass with C = 1 Low-pass Ideal Approximatn
Sept'05CS G( ) 1 G( ) 1 CC LL UU High-pass Band-pass
Sept'05CS G( ) 1 LL UU Band-stop
Sept'05CS 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
Sept'05CS 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
Sept'05CS G( ) 1 NN Notch All-pass Third type of ‘band-stop’ gain-response Yet another type of gain-response G( ) 1
Sept'05CS Comments: Given H(s) for low-pass gain-resp. with C =1, freq-band transfns always work & must be used for narrow-band. ‘Broad-band’ band-pass & band-stop transfer fns can be obtained by combining low-pass & high-pass. ‘Notch’ gain-resp. is band-stop with very narrow stop-band. Used for ‘notching out’ sinusoidal tone at one frequency. All-pass gain-responses do nothing to magnitudes of sinusoids but can change their phases in useful ways.
Sept'05CS Use of MATLAB for analogue filter design High level language for matrix operations & complex numbers. Ideal for studying & implementing signal processing operations. Variables declared automatically when first used. Each variable may be a matrix with complex elements. E.g.: X = [ j ]; % Comment If semicolon omitted, print result of assignment. It is easy to generate sections of sine-waves. You need to know the sampling frequency f S in Hz. Can make f S = 1 Hz which means 1 sample every second).
Sept'05CS Produce row matrix x containing 100 samples of 1/20 Hz sine- wave when f S = 1 Hz. Plot this as a graph: for n = 1:100 x(n) = sin(n*2*pi / 20); % 2 /20 radians/second end; plot(x); seconds
Sept'05CS Produce 100 samples of a 0.7 Hz sine-wave when f S = 10 Hz: fs = 10; f = 0.7; for n = 1:100 x(n) = sin(n*2*pi * f /fs ); end; plot( [1:100]/fs, x); seconds
Sept'05CS Note: ‘ [1:100] / fs ’ is a row matrix [1, 2, …, 100] with each element divided by fs. Following example shows how a WAV file containing speech or music may be read in, listened to & plotted in sections. Sections may be processed and written to a second file. ‘Control-C’ will interrupt a running MATLAB program even when in a infinite loop.
Sept'05CS clear all; [x, fs, nbits] = wavread('cap4th.wav'); SOUND(x,fs,nbits); for n=1:1000 y(n)=x(n+10000); end; plot([1:1000]/fs,y); wavwrite(y,fs,nbits,’newfile.wav’);
Sept'05CS MATLAB Signal Processing toolbox: A set of functions available to user of MATLAB for: (i) carrying out operations on signal segments stored in row matrices (ii) evaluating the effect of these operations, (iii) designing analogue & digital filters. Some of these functions are as follows: are:
Sept'05CS zplane(a,b)% Plot poles & zeros of H(s) on Argand diag. [a,b] = butter(n, wc,’s’)% H(s) for nth order analog Butterw % low-pass with cut-off wc. [a,b] = butter(n, wc, ‘high’,’s’);% High-pass analog Butterw. [a,b] = butter(n, [wL wU],’s’ );% Band-pass analog Butterw. [a,b] = butter(n, [wL wU],’stop’,’s’); % Band-stop.. freqs(a,b)% Plot analogue frequency-response H(j ) when
Sept'05CS Other analogue gain response approximations: [a,b] = cheby1(n, Rp,wc,’s’ ); % Low-pass Chebychev type 1. % Rp = pass-band ripple in dB. [a,b] = cheby2(n, Rs,wc,’s’ ); % Low-pass Chebychev type 2. % Rs = stop-band ripple in dB (Slight error in notes (‘discrete time’).
Sept'05CS Examples:- 1. Use MATLAB to plot gain response of Butterwth type analog low-pass filter of order 4 with C = 100 radians/second. for w = 1 : 400 G(w) = 1/sqrt(1+(w/100)^8) ; end; plot(G); grid on;
Sept'05CS Result obtained:-
Sept'05CS Using Signal Processing toolbox calculate coeffs of 3rd order Butt low-pass filter with C = 5, & plot gain & phase resp. Solution: [a,b] = butter(3,5,’s’); freqs(a,b); Result obtained:- a = b =
Sept'05CS329162
Sept'05CS Postscript MATLAB goes not give H(s) with its denominator expressed in 2nd order sections as our earlier formula did. This is sometimes inconvenient. As an exercise, find out how to use MATLAB to produce H(s) in 2nd order sections.
Sept'05CS : Problems on Section 2: 2.1 Is it true that if a system is linear & its input is a sine-wave, its output must be a sine-wave? 2.2. If L 1 & L 2 are LTI with imp-responses h 1 (t) & h 2 (t), calculate imp-response of each arrangement below. Show that these 2 arrangements with input same x(t) produce same output y(t): 2.3. An LTI system has impulse response: 1 : 0 t 1 h(t) = 0 : otherwise Sketch its gain & phase responses.
Sept'05CS An LTI system has impulse response: 1 : 1 t 2 h(t) = 0 : otherwise Sketch its gain & phase responses & compare with previous. 2.5.We wish to design an LTI system with impulse response: cos ( 0 t) : 0 t 2 / 0 h(t) = 0 : otherwise Is it stable and/or causal & what is its frequency-response? 2.6. Show that for stable system, H(j ) cannot be infinite for any .
Sept'05CS Calculate impulse-response of analogue filter with: 1 : | | 1 radian/second H(j ) = 0 : | | >1 Why can this ideal filter not be realised as a practical circuit? 2.8. Write down inverse FT to give h(t) in terms of H(j ). Split it into 2 integrals, & express H(j ) in polar form. Show that when H(-j ) = H*(j ) for all 1 h(t) = | H(j ) | cos( ( ) + t )d if ( )= Arg [H(j )] 0 Then show that if - ( )/ = D for all , h(t) must be symmetric about t = D; i.e. h(D+t) = h(D-t) for all t. What does this tell us about the possibility of designing analog filters which are exactly linear phase?
Sept'05CS An LTI analog crt has: H(s) = 1 / (1 + s) Give its gain & phase responses & its phase delay at = Give H(s) for a Butterwth low-pass gain response with 3dB cut-off at 1 rad/sec, of order: (i) n=6 & (ii) n= Can we design 4th order Butterwth lowpass filter with 3dB cut-off C by cascading two identical 2nd order Butterwth low-pass filters? Give H(s) for a Butterwth high-pass gain response with 3dB cut-off C =2 & of order (i) n=2, (ii) n=3 and (iii) n= Give H(s) for Butterwth band-pass approxn with L =3 & U = 4, of order (i) n=2, (ii) n=3, & (iii) n=4. This will involve 4th order denominator polynomials in s Convert the 4th order polynomials in previous question to product of two 2nd order polynomials in s. Hence express H(s) as product of 2nd order sections. Use MATLAB!
Sept'05CS With 2nd order Butterwth low-pass prototype, use a frequency band transformn to derive H(s) for 4th order band-pass filter with L =2 & U =20. Express H(s) as product of 2 nd order sections using MATLAB Consider an easier approach to deriving H(s) for 4th order band-pass & band-stop filters where we express H(s) = H LP (s) H HP (s), i.e. product of a 2 nd order low-pass & a 2 nd order high-pass section. Repeat the 4 th order band-pass design exercises above by this method & use MATLAB to compare gain responses. The exercises have (i) L =3, U =4 ("narrow-band") and (ii) L =2, U =20 ("wide-band")
Sept'05CS R R1R1 xy R 1 y = x R + R 1 R C X(s) Y(s) 1/Cs Y(s) = X(s) R + 1/Cs Appendix A: Analysis of RC circuit
Sept'05CS Y(s) 1/Cs 1/(RC) H(s) = = = X(s) R + 1/Cs s + 1/(RC) H(s) is Laplace transform of h(t). By tables, the Laplace transform of 0 : t < 0 1 x(t) = is X(s) = e - a t : t 0 s + a Replacing "a" by 1/RC: 0 : t < 0 h(t) = (1/RC)e - t / R C : t 0