Chapter 2 Discrete-time signals and systems 2.1 Discrete-time signals:sequences 2.2 Discrete-time system 2.3 Frequency-domain representation of discrete-time signal and system 1 2.1 Discrete-time signals:sequences 2.1.1 Definition 2.1.2 Classification of sequence 2.1.3 Basic sequences 2.1.4 Period of sequence 2.1.5 Symmetry of sequence 2.1.6 Energy of sequence 2.1.7 The basic operations of sequences 2 2.1.1 Definition x x[n] EXAMPLE n Enumerative representation x[n] {1,2,1.2,0,1,2,2.5},1 n 5 x[n] 0.9 cos(0.2n / 2),0 n 10 n Function representation 3 2 0.5 1 0 0 -1 -0.5 -2 -3 -2 -1 0 2 4 6 0 5 10 Graphical representation 4 Generate and plot the sequence in MATLAB n=-1:5 x=[1,2,1.2,0,-1,-2,-2.5] stem(n,x, '.') n=0:9 y=0.9.^n.*cos(0.2*pi*n+pi/2) stem(n,y,'.') 5 x[n] xa (t ) |t nT xa (nT ) EXAMPLE Sampling the analog waveform Figure 2.2 6 Display the wav speech signal in ULTRAEDIT 7 Display the wav speech signal in COOLEDIT The whole waveform Display the wav speech signal in local Blowup 8 2.1.2 Classification of sequence Right-side x[n] 0, for n N Left-side x[n] 0, for N n Two-side x[n] 0, for n Finite-length x[n] 0, outside of N1 n N2 Causal x[n] 0, for n0 Noncausal x[n] 0, for n 0 9 2.1.3 Basic sequences 1. Unit sample sequence 1 [ n] 0 n0 1 n0 n 0 2.The unit step sequence 1 u[n] 0 δ[n] n0 u[n] 1 n0 n 0 3.The rectangular sequence 1 RN [ n ] 0 0 n N 1 other R[n] 1 10 0 N-1 n 4. Exponential sequence x[n] a n 11 x[n] a n (re j ) n 12 5. Sinusoidal sequence x[n] A cos(n ) : frequency, radians / sample cos(0.9n) cos(1.8n) x[n] A cos(n ) A cos(2n (n )) A cos((2 )n ) 13 x[n] A cos(n ) A cos(( 2k )n ) For convenience, sinusoidal signals are usually expressed by exponential sequences. A j (n ) A sin n e e j (n ) 2j A j (n ) A cosn e e j (n ) 2 The relationship between ω and Ω: x[n] A sin( n ) xc (t ) |t nT A sin( t ) |t nT A sin( nT ) T / f s f /( 2 ) unit : f : Hz( period / sec ond ) : radians / sec ond : radians / sample 14 2.1.4 Period of sequence if x[n] x[n N ], n , then period is N x(t ) A sin(t ) A sin(t 2 ) A sin((t 2 / ) ) T 2 / x[n] A sin(n ) A sin(n 2l ) A sin((n 2l / ) ) x[n 2 l / ] integer N,period N 2 / rational number P / Q,period P irrational number ,period 15 Three kinds of period of sequence 2 / N 2 / P / Q,N P 16 2.1.5 Symmetry of sequence x[n] x[n], even sequence x[n] x[n], odd sequence x[n] x*[n] Conjugate-symmetric sequence x[n] x*[n] Conjugate-antisymmetric sequence 17 x[n] xe [n] xo [n] xe [n] xe [n] x e [ n] x[n] x[n] 2 xo [n] xo [n] x o [ n] x[n] x[n] 2 x[n] xe [n] xo [n] xe[n] xe*[n] x[n] x * [n] x e [ n] 2 xo[n] xo*[n] x[n] x * [n] x o [ n] 2 18 EXAMPLE x[n] (n 1) R6[n] n=[-5:5]; x=[0,0,0,0,0,1,2,3,4,5,6]; xe=(x+fliplr(x))/2; xo=(x-fliplr(x))/2; subplot(3,1,1) stem(n,x) subplot(3,1,2) stem(n,xe) subplot(3,1,3) stem(n,xo) Real sequences can be decomposed into two symmetrical sequences. 19 EXAMPLE x[n] (1 j ) R6[n] n Complex sequences can be decomposed into two symmetrical sequences. n=[-5:5]; x=zeros(1,11); 2 x((n>=0)&(n<=5))=(1+j).^[0:5]0 xe=(x+conj(fliplr(x)))/2; -2 xo=(x-conj(fliplr(x)))/2 -4 subplot(3,2,1); -5 stem(n,real(x)) 2 subplot(3,2,2); stem(n,imag(x)) 0 subplot(3,2,3); -2 stem(n,real(xe)) -5 subplot(3,2,4); 2 stem(n,imag(xe)) subplot(3,2,5); 0 stem(n,real(xo)) subplot(3,2,6); -2 -5 stem(n,imag(xo)) 2 0 -2 0 5 -4 -5 2 0 5 0 5 0 5 0 0 5 -2 -5 1 0 -1 0 5 -2 -5 20 2.1.6 Energy of sequence E | x[n] |2 n x[n]x*[n] n 21 2.1.7 The basic operations of sequences 1. y[n] x[n n0 ] 2. y[n] x[n] 3. y[n] a x[n] 4. y[n] x[n] w[n] 5. y[n] a x[n] 6. y[n] x[n] w[n] 22 Basic operations of sequences 23 Original speech sequences sequences after vector addition sequences after vector multiplication Original music sequence sequences after scalar multiplication echo 24 EXAMPLE The matlab codes on the addition of two sequences x[n] [1,2,4,6,5,8,10] y[n] 3x[n 2] x[n 4] 40 20 0 -2 0 -1 0 -5 0 5 10 26 n=[-4:2] ; x=[1,-2,4,6,-5,8,10] ; %x1[n]=x[n+2] n1=n-2; x1=x; %x2[n]=x[n-4] n2=n+4; x2=x; %y[n] m=[min(min(n1),min(n2)): max(max(n1),max(n2))] ; y1=zeros(1,length(m)) ; y2=y1; y1((m>=min(n1))&(m<=max(n1)))=x1;y2((m>=min(n2))&(m<=max(n2)))=x2; y=3*y1+y2; stem(m,y) Output:y =3 -6 12 18 -15 24 31 -2 4 6 -5 8 10 27 7.convolution sum: y[n] x[n] h[n] k k x[k ]h[n k ] x[n k ]h[k ] (1) x[n] * h[n] h[n] * x[n] (2) x[n] * (h1[n] h2 [n]) x[n] * h1[n] x[n] * h2 [n] (3)( x[n] * h1[n]) * h2 [n] x[n] * (h1[n] * h2 [n]) (4) x[n] * [n] x[k ] [n k ] x[n], x[n] * [n n ] x[n n ] k 0 0 (5)if x[n] 0, outside N 0 n N1 , length L1 h[n] 0, outside N 2 n N 3 , length L2 then, y[n] 0, outside N 0 N 2 n N1 N 3 , length L1 L2 1 steps:turnover, shift, vector multiplication, addition 28 EXAMPLE 1, n 1,...4 x[n] 0.5 u[n], h[n] , y[n] x[n] * h[n] 0, other n nx=0:10; nh=-1:4; y=conv(x,h); x=0.5.^nx; h=ones(1,length(nh)) stem([min(nx)+min(nh):max(nx)+max(nh)],y) 29 8.crosscorrelation: x[k ] y[k n] x[n] y[n] r rxy [n] yx [ n] k or, rxy [n] x[k ] y[k n] k aotocorrelation: rxx [n] x[k ]x[k n] x[n] x[n] r xx [ n] k 30 31 example:correlation detection in digital audio watermark pseudo random sequences : w[n] {1,1}, n 0 : 1023 x[n] : original audio sequences, n 0 : 1023 embed the watermark :xw [n] x(n) 0.1 | x[n] | w(n), n 0 : 1023 detect the watermark :xw _ o[n] high pass filter ( xw [n]) w _ o[n] high pass filter ( w[n]) rxw _ o , w _ o , compare the maximum with the threshold to confirm the presence of the watermark 32 33 34 2.1 summary •2.1.1 Definition •2.1.2 Classification of sequence •2.1.3 Basic sequences •2.1.4 Period of sequence •2.1.5 Symmetry of sequence •2.1.6 Energy of sequence •2.1.7 The basic operations of sequences 35 requirements:judge the period of sequence ; calculate convolution with graphical and analytical evaluation . key: convolution 36 2.2 Discrete-time system 2.2.1 Definition:input-output description of systems 2.2.2 Classification of discrete-time system 2.2.3 Linear time-invariant system(LTI) 2.2.4 Linear constant-coefficient difference equation 2.2.5. Direct implementation of discrete-time system 37 2.2.1 definition:input-output description of systems y[n] T [ x[n]] x[n] h[n] T [ [n]] T[ ] y[n] the impulse response 38 EXAMPLE y[n] 2 x[n] y[n] max{ x[n 1], x[n], x[n 1]} echo system : y[n] x[n] ax[n nd ] 0 accumulato r : y[n] x[n k ] k ideal delay : y[n] x[n 5] M2 1 moving average : y[n] x[n k ] M 1 M 2 1 k M1 backward difference : y[n] x[n] x[n 1] forward difference : y[n] x[n 1] x[n] 39 2.2.2 classification of discrete-time system 1.Memoryless (static) system the output depends only on the current input. 2.Linear system T [ax1[n] bx2 [n]] aT [ x1[n]] bT [ x2 [n]] 3.Time-invariant system: if T [ x[n]] y[n], then T [ x[n n0 ]] y[n n0 ] 4.Causal system: the output does not depend on the latter input. 5.Stable system: if | x[n] | , then | T [ x[n]] | 40 2.2.3 linear time-invariant system(LTI) characteri zed by y[n] x[n] * h[n] h[n] k k x[k ]h[n k ] x[n k ]h[k ] How to get h[n] from the input and output: let x[n] [n], then y[n] h[n] 41 the impulse response in LTI EXAMPLE (1) y[n] 2 x[n], h[n] 2 [n] (2) y[n] x[n] 0.5 x[n 50] h[n] [n] 0.5 [n 50] h[0] 1, h[50] 0.5 0 (3) y[n] x[n k ] k 0 h[n] [n k ] u[n] k (4) y[n] 1 M1 M 2 1 1 h[n] M1 M 2 1 M2 x[n k ] k M1 1 , M1 n M 2 [ n k ] M1 M 2 1 0, other k M1 M2 42 Properties of LTI h[n] h[n] h1[n] h2[n] h2[n] Figure 2.12 x[n] h1[n] h1[n] h2[n] 43 classification of linear time-invariant system (1) FIR : h[n]' s length is IIR: finite h[n]’s length is infinite (2)causal : h[n] 0, for n 0 causal causal FIR IIR prove : y[ n] x[ n] h[ n] k 1 h[k ]x[n k ] h[k ]x[n k ] h[k ]x[n k ] k k 0 the latter input the former input (3) stable : | h[n] | n FIR must be stable。 44 2.2.4 linear constant-coefficient difference equation N a k 0 M k y[n k ] bk x[n k ] k 0 1.relation with input-output description and convolution EXAMPLE For IIR,the latter two are consistent. accumulator system( IIR ) input-output description y[n] x[n k ] k 0 u[k ]x[n k ] k convolution description y[n] x[n] * h[n] h[k ]x[n k ], while h[n] u[n] infinite items,unrealizable k difference equation description y[n 1] Finite items, realizable x[n 1 k ] y[n] x[n] y[n 1] k 0 45 EXAMPLE For FIR,the followings are consistent M 2 1 input-output description and y[n] x[n k ] difference equation description M 2 1 k 0 (non-recursion) 1 ,0 n M 2 y[n] x[n] * h[n],while h[n] M 2 1 0, other Convolution description Another difference equation description,recursion,lower rank y[n] y[n 1] 1 M2 1 1 M2 1 M2 M2 x[n k ] M 1 x[n 1 k ] k 0 1 2 k 0 ( x[n] x[n M 2 1]) For FIR and IIR,difference equations are not exclusive. 46 2.Recursive computation of difference equations: For IIR, there needs N initial conditions , then ,the solution is unique. For FIR, there needs no initial conditions. With initial-rest conditions (linear, time invariant, and causal), the solution is unique. EXAMPLE y[n] ay[n 1] x[n] y[1] 1, x[n] [n], det er min y[n] y[0] a 1 y[1] a ( a 1) 0 y[ 2] a a ( a 1) 0 y[ n] a n ( a 1), n 0 y[ 2] 1 / a ( y[ 1] x[ 1]) a 1 y[ 3] a 2 y[ n] a n 1, n 0 y[ n] a n 1 a nu[ n] 47 3.computation of difference equations with homogeneous and particular solution with the input x[n] and initial conditions ,the output can be written as y[n] y p [n] yh [n] the particular solution y p [n] is the response to the input x[n] under some initial condition. ususlly, take the casual LTI as initial condition, then get y p [n], which is called zero - state response and can be solved by the z - transform ; the homogeneou s solution yh [n] is the response when the input is zero , N viz. the solution of a m 1 k yh [n k ] 0, which is called zero - input response N y h [ n] A z , m 1 n m m N z m is the root of a z m 1 k k 0, Am can be solved from the initial conditions . 48 2.2.5. Direct implementation of discrete-time system EXAMPLE FIR h[n] [n] [n 1] 2 [n 2] 2 y[n] x[n] * h[n] h[k ]x[n k ] x[n] x[n 1] 2 x[n 2] k 0 x[n] z-1 z-1 2 -1 + + y[n] 49 EXAMPLE IIR h[n] u[n] y[n] x[n] * h[n] x[n k ] k 0 y[n] x[n] y[n 1] x[n] + y[n] z-1 50 x[ n] u[ n] EXAMPLE y[ n] x[ n] y[ n 1] H ( z) 1 1 z 1 A=[1,-1] n=[0:100]; y=filter(B,A,x); stem(n,y); The matlab codes on the direct realization of LTI B=1; x=[n>=0]; axis([0,20,0,20]) 51 keys: judge the type of a system(from the relationship between the input and output, and from h[n] for LTI). the physics meaning of convolution representation for LTI: the output signals are the weighted combination of the input signals, h[n] is the weight。 the similarities and differences between linear constant-coefficient difference equations and convolution representation,recursive computation。 the difference between IIR and FIR: FIR IIR h[n] finite length infinite length y[n]是x[n]的加权 finite items infinite items realization stability convolution or difference stable difference , recursion maybe stable 53 2.3 frequency-domain representation of discrete-time signal and system 2.3.1 definition of fourier transform 2.3.2 frequency response of system 2.3.3 properties of fourier transform 54 EXAMPLE The intuitionistic meaning of frequencydomain representation of signals x(t ) cos(2 100 t ) 0.5 cos(2 200 t ), f1 100 Hz , f 2 200 Hz 2 10 1 5 0 -1 0 0.01 0.02 0 0 100 200 300 400 500 55 The intuitionistic meaning of frequencydomain representation of systems y(t ) T {x(t )} cos(2 100t ), f 100Hz 1 频响 10 0.5 0 5 -0.5 -1 0 0.01 0.02 0 0 100 200 300 400 500 150Hz f 56 EXAMPLE The effect of lowpass and highpass filters to image signals 57 Frequency-domain analysis of de-noise process through bandstop filter 58 Derivation of Fourier transform 3 x[n] | X ( ) | cos(n ( )) 3 e j (n ( )) e j (n ( )) | X ( ) | 2 0 3 3 0 | X ' ( ) | e j (n ( )) 3 X ( )e jn 3 X ( ) | X ' ( ) | e j ( ) 59 2.3.1 definition of fourier transform 1 j jn x[n] X ( e ) e d 2 X e j x[n]e jn n X (e j ) X R (e j ) jX I (e j ) | X (e j ) | e jX (e j ) ) | X e j |, magnitude ARGX e : principal X e j , phase arbitrary phase j value phase arg X e j , continuous phase X e j ( 2 ) x[n]e j ( 2 ) n X e j 60 x[n] 0.2n u[n], X (e j ) EXAMPLE 1 1 0.2e j subplot(2,2,1); fplot('real(1/(1-0.2*exp(-1*j*w)))',[-2*pi,2*pi]); subplot(2,2,2); fplot('imag(1/(1-0.2*exp(-1*j*w)))',[-2*pi ,2*pi]); subplot(2,2,3); fplot('abs(1/(1-0.2*exp(-1*j*w)))',[-2*pi,2*pi]); subplot(2,2,4); fplot('angle(1/(1-0.2*exp(-1*j*w)))',[-2*pi,2*pi]); ʵ²¿ Ð鲿 1.5 0.5 1 0 0.5 -0.5 -5 0 ·ù¶È 5 1.5 0.5 1 0 0.5 -0.5 -5 0 title('实部') title('虚部') title('幅度') title('相位') 5 Matlab codes to draw the frequency chart of signals -5 0 Ïàλ 5 -5 0 5 61 Fourier transforms of nonabsolutely summable or nonsquare summable signals EXAMPLE sin(c n) x[n] , n n 1, | | c j X (e ) 0, | | c sin( c n) 1 c jn j IFT [ X e ] e d 2 c n EXAMPLE x[n] 1 2 2r X e j r 1 jn IFT [ X e ] [ 2 2 r ] e d 2 r 1 jn 2 e d 1 2 j 62 2.3.2 frequency response of system h[n]e He j jn 1 h[n] H (e j )e jn d 2 | H e j |: amplitude response H e j : phase response 63 EXAMPLE Ideal filter in frequency and time domain | | c 1 H lp (e ) c | | 0 sin( c n) 1 c jn hlp [n] e d c 2 n j 64 EXAMPLE Matlab codes to draw the frequency response of a system echo system : y[n] x[n] 0.5x[n 10] h=[1,0,0,0,0,0,0,0,0,0.5] freqz(h,1) 65 Eigenfunction and steady-state response: (1) x[n] e j 0 n , n y[n] x[n] * h[n] e j 0 k h[n k ] k let , n k k ' e j 0 ( n k ') h[k ' ] H (e j 0 )e j 0 n k | H (e j 0 )|e j 0 n j H ( e j 0 ) (2) x[n] ak e j k n , n k y[n] x[n] * h[n] a k H (e j k )e j k n k (3) x[n] e j0 n u[n] y[n] H (e j 0 )e j 0 n ( h[k ]e jk )e jn k n 1 Steady-state response transient response 66 y[n] h[k ]x[n k ] k 0 h[0]x[n] h[1]x[n 1] h[]x[n ] causal FIR system acts on causal signal h[N-1] h[0] Causal and stable IIR system acts on causal signal h[0] Figure 2.20 67 Sin(0.1*pi*n) example of steady-state response h[n]=[1,1,1,1,1,1,1,1,1,1]/4 B=[1,0,1,0,1];A=[1,0.81,0.81,0.81] 68 2.3.3 properties of fourier transform F 1.linearity : ax[n] by[n] aX (e j ) bY (e j ) F 2.time shifting : x[n n0 ] e jn0 X (e j ) F 3. frequency shifting : e j0n x[n] X (e j ( 0 ) ) 69 5.x[n] y[n] X (e j )Y (e j ) F 1 1 6.x[n] y[n] X (e j ) Y (e j ) 2 2 F 7. parseval : n X (e j )Y (e j ( ) )d 1 x[n] y [n] X (e j )Y * (e j )d 2 * 1 j 2 E | x[n] | | X ( e ) | d 2 n 2 70 8.x*[n] X * (e j ), x[n] X (e j ), x*[n] X * (e j ) F F F x[n] x*[n] F X (e j ) X * (e j ) j Re( x[n]) X e (e ) 2 2 x[n] x*[n] F X (e j ) X * (e j ) j j Im( x[n]) X o (e ) 2 2 X (e j ) X * (e j ) Im( x[n]) 2j F x[n] x*[n] F X (e j ) X * (e j ) j xe[n] Re[ X (e )] 2 2 x[n] x*[n] F X (e j ) X * (e j ) j xo [n] j Im[ X (e )] 2 2 71 9.x[n] x * [n] X (e j ) X * (e j ), for real sequences Re[ X (e j )] Re[ X (e j )] Im[ X (e j )] Im[ X (e j )] | X (e j ) || X (e j ) |, X (e j ) X (e j ) X (e j ) X * (e j ( 2 ) ) X * (e j (2 ) ) 72 2.3 summary 2.3.1 definition of fourier transform 2.3.2 frequency response of system 2.3.3 properties of fourier transform requirements:calculation of fourier transforms steady-state response linearity time shifting frequency shifting the convolution theorem windowing theorem Parseval’s theorem symmetry properties 73 Keys and difficulties: the convolution theorem; the frequency spectrum of a real sequence is conjugate symmetric; the frequency spectrum of a conjugate symmetric sequence is a real function. exercises: 2.35 2.45 2.57 74