Chapter 4 sampling of continous-time signals 4.1 periodic sampling 4.2 discrete-time processing of continuous-time signals 4.3 continuous-time processing of discrete-time signal 4.4 digital processing of analog signals 4.5 changing the sampling rate using discrete-time processing 4.1 periodic sampling 1.ideal sample x[n] xc (t ) |t nT xc (nT ) T:sample period fs=1/T:sample rate Ωs=2π/T:sample rate Figure 4.1 ideal continous-time-to-discrete-time(C/D)converter time normalization tt/T=n (t nT ) n Figure 4.2(a) mathematic model for ideal C/D Figure 4.3 frequency spectrum change of ideal sample s N N 1 X s ( j) T X ( j( k )) c k No aliasing s N N aliasing X (e j ) X s ( j) | / T s / 2 aliasing frequency 2 T 1 T X ( j( k 2 ) / T ) c k s Period =2πin time domain: w=2.1πand w=0.1πare the same trigonometric function property cos(2.1n) cos(0.1n) high frequency is changed into low frequency in time domain: w=1.1π and w=0.9πare the same trigonometric function property cos(1.1n) cos(0.9n) 2.ideal reconstruction Figure 4.10(b) ideal D/C converter ideal reconstruction in frequency domain Figure 4.4 s / 2 EXAMPLE Figure 4.5 s 0 Take sinusoidal signal for example to understand aliasing from frequency domain EXAMPLE xa (t ) cos(2 5t ),0 t 1, f 5Hz Sampling frequency:8Hz Reconstruct frequency: f ' 8 5 3Hz Figure 4.10(a) mathematic model for ideal D/C X r ( j) X s ( j) H r ( j) X c ( j) T H r ( j) 0 | | c | | c X r ( j ) X s ( j ) H r ( j ) 1 hr (t ) IFT {H r ( j)} 2 sin( c t ) sin( t / T ) t / T t / T H r ( j ) e xr (t ) xs (t ) hr (t ) [ x[n] (t nT )] n jt 1 d 2 C C Te jt d sin( t / T ) t / T sin( t / T ) sin[ (t nT ) / T ] ideal reconstruction in x[n][ (t nT ) ] x[n] t / T (t nT ) / T n n time domain sin( x) sin c( x) x sin c( x) EXAMPLE Figure 4.9 EXAMPLE understand aliasing from timedomain interpolation 3.Nyquist sampling theorems s N N s N N Nyquist sampling theorems: let xc (t ) be a band lim ited signal with X c ( j) 0, | | N then xc (t ) is uniquely det er min ed by its samples x[n] xc (nT ), n 0,1,2, if s N N , that is ( s 2 1 ) 2 N , or ( f s ) 2 f N T T s / 2 : nyquist frequency 2 N : nyquist rate s 2 N : oversampling s 2 N : undersampling Haa ( j) c s / 2 Figure 4.41 Digital processing of analog signals examples of sampling theorem(1) The highest frequency of analog signal ,which wav file with sampling rate 16kHz can show , is: 8kHz The higher sampling rate of audio files, the better fidelity. examples of sampling theorem(2) according to what you know about the sampling rate of MP3 file,judge the sound we can feel frequency range( (A)20~44.1kHz (C)20~4kHz B ) (B)20~20kHz (D)20~8kHz EXAMPLE Matlab codes to realize interpolation xa (t ) cos(10t ),0 t 1, f 5Hz f s 10 Hz(T 0.1s ) draw x[n] xa (nT ) cos(10nT ) cos(n) draw reconstruction signal : y (t ) n x[n] sin[ (t nT ) / T ] (t nT ) / T T=0.1; n=0:10; dt=0.001; y=x*sinc((t-n*T)/T); x=cos(10*pi*n*T); t=ones(11,1)* [0:dt:1]; hold on; stem(n,x); n=n'*ones(1,1/dt+1); plot(t/T,y,'r') Supplement: band-pass sampling theorem: f s 2( f H f L )(1 M / N ) fH N int fH fL fH N M fH fL f H 5B 4 B f H 5B 4fs Nf s 2 f H fH / B (M N ) f s 2 f H / N 2B 2B 2 B(1 M / N ) N N 4.1 summary 1.representation in time domain of sampling x[n] xc (t ) |t nT xc (nT ) 2.changes in frequency domain caused by sampling 1 X s ( j) T X ( e j ) 1 T X ( j( k )) c k s X ( j( k 2 ) / T ) c k 3. understand reconstruction in frequency domain 4. understand reconstruction in time domain 5. sampling theorem s N N s N N Requirements and difficulties: frequency spectrum chart of sampling and reconstruction comprehension and application of sampling theorem 4.2 discrete-time processing of continuous-time signals Figure 4.11 H (e jT ) | | / T H eff ( j) 0 | | / T conditions:LTI;no aliasing or aliasing occurred outside the pass band of filters EXAMPLE Figure 4.12 EXAMPLE aliasing occurred outside the pass band of digital filters satisfies the equivalent relation of frequency response mentioned before. Figure 4.13 4.3 continuous-time processing of discrete-time signal Figure 4.16 H (e j ) Hc ( j / T ) c Figure 4.12 for | | EXAMPLE Ideal delay system:noninteger delay H (e j ) e j 4.4 digital processing of analog signals quantization and coding Figure 4.41 Sampling and holding Figure 4.46(b) uniform quantization and coding Figure 4.48 2 X m / 2 B , B : bit numbers SNR 6 B 1.25(dB) Figure 4.51 quantization error of 3BIT quantization error of 8BIT nonuniform quantization 量化后的电平 0 量化前的电平 vector quantization 一维信号例子: index0 x 4 4 3 3 3 2 3 3 2 1 codeword 1 1 c0 c1 d(x,c1)=11 d(x,c2)=8 3 3 2 codeword d(x,c0)=5 4 4 x codeword 1 c2 2 1 d(x,c3)=8 codeword c3 码书 vector quantization Example: image coding Initial image block(4 gray-levels,dimentions k=4×4=16) x 0 Code book C ={y0, y1 , y2, y3} 1 2 3 d(x,y0)=25 d(x,y1)=5 d(x,y2)=25 d(x,y3)=46 y0 y1 y2 y3 codeword y1 is the most adjacent to x,so it is coded by the index “01”. reconstruction Figure 4.53 D/A过程 h(t ) RN (t ) Figure 4.5 record the digital sound Influence caused by sampling rate and quantizing bits Different tones require different sampling rates. 4.1~4.4 summary 1. representation in time domain and changes in frequency domain of sampling and reconstruction. sampling theorem educed from aliasing in frequency domain 2. analog signal processing in digital system or digital signal in analog system , to explain some digital systems , their frequency responses are linear in dominant period 3. steps in A/D conversion Requirements and difficulties: sampling processing in time and frequency domain, frequency spectrum chart; comprehension and application of sampling theorem; frequency response in discrete-time processing system of continuous-time signals; 4.5 changing the sampling rate using discrete-time processing 4.5.1 sampling rate reduction by an integer factor (downsampling, decimation) 4.5.2 increasing the sampling rate by an integer factor (upsampling, interpolation) 4.5.3 changing the sampling rate by a noninteger fact 4.5.4 application of multirate signal processing 4.5.1 sampling rate reduction by an integer factor (downsampling, decimation) xd [n] x[nM ] a sampling rate compressor : Figure 4.20 time-domain of downsampling :decrease the data,reduce the sampling rate M=2,fs’=fs/M,T’=MT frequency-domain of downsampling :take aliasing into consideration X d e j ( 2i ) / M 1 M j ( 2i ) / M X e M 1 i 0 EXAMPLE M=2 1 X d (e ) X e j / 2 X e j ( 2 ) / 2) 2 j X (e j ) 2 0 X d ( e j ) 2 1/ 2 2 0 Figure 4.21(c)(d) 2 EXAMPLE M=3 1 X d (e ) X e j / 3 X e j ( 2 ) / 3) X e j ( 4 ) / 3) 3 j X (e j ) 2 0 2 0 j X d (e ) 2 2 EXAMPLE M=3,aliasing Figure 4.22(b)(c) frequency spectrum after decimation:period=2π, M times wider,1/M times higher Condition to avoid aliasing: N / M Total downsampling system:Total system Figure 4.23 4.5.2 increasing the sampling rate by an integer factor (upsampling, interpolation) x[n / L] xe [n] 0 n 0, L,2 L other or , xe [n] x[k ] [n kL] k a sampling rate exp ander : x[n] L x e [n] time-domain of upsampling :increase the data,raise the sampling rate L=2,fs’=Lfs,T’=T/L frequency-domain of upsampling: need not take aliasing into consideration X e (e j ) X (e jL ) EXAMPLE Figure 4.25 L=2 Take T’=T/L as D/C: L L /T' T N frequency domain of reverse mirror-image filter transverse axis is 1/L timer shorter,magnitude has no change. L mirror images in a period. Period=2π,also period =2 π /L total upsampling system:total system Figure 4.24 time-domain explanation of reverse mirror-image filter :slowly-changed signal by interpolation hi [n] IFT [ H e j ] L sin n / L n xi [n] xe [n] hi [n] ( x[k ] [n kL]) hi [n] k x[k ]( [n kL] h [n]) k i (n kL) sin L x[k ]hi [n kL] x[k ] (n kL) k k L EXAMPLE time-domain process of mirror-image filter Use linear interpolation actually Figure 4.27 4.5.3 changing the sampling rate by a noninteger factor fs ' fs Figure 4.28 L M EXAMPLE change 400 Hz' s signal to 300 Hz L 3, M 4 X (e j ) 2 2 0 X e (e j ), X i (e j ) 0 / 4 2 2 Y ( e j ) 2 0 2 Advantages of decimation after interpolation: 1.Combine antialiasing and reverse mirror-image filter 2.Lossless information for upsampling 4.5.4 application of multirate signal processing 1.Sampling system:replace high-powered analog antialiasing filter and low sampling rate with low-powered analog antialiasing filter , oversampling and high-powered digital antialiasing filter, decimation. Transfer the difficulty of the realization of highpowered analog filter to the design of high-powered digital filter. Figure 4.43 FIGURE 4.44 2.reconstruction system:replace high-powered analog reconstructing filter with interpolation, high-powered digital reverse mirror-image filter and low-powered analog analog reconstructing filter. xe[n] x[n] ↑L 反镜像滤波 xi[n] 零阶保持 h1(t) 模拟重构滤波 x(t) 3. filter bank x[n] analysis and synthesis of sub band h0 [n] h1 [ n ] M M y 0 [ n] y1 [ n ] M h0 [n] M h1 [ n ] .......... .......... .......... .......... . y N [n] hN [n] M M hN [n] x[n] In MP3, M=32,sub-band analysis filter bank is 32 equi-band filters with center frequency uniformly distributed from 0 to π : MP3 coders use different quantization to realize compression for signals yi[n] in different sub-bands. example:compression for M=2 X ( e j ) 0 2 Y0 (e j ) Y1 (e j ) ' ' 0 2 0 2 0 Y0 (e j ) 2 2 Y1 (e j ) '' '' 2 0 Y1 (e j ) ' Y0 (e j ) ' 0 2 Y1 (e j ) Y0 (e j ) 0 0 2 0 2 bit rate before compressio n: 16bit f s bit rate after compressio n: 16bit fs / 2 8bit fs / 2 12bit fs 4.pitch scale:decimation or interpolation ,sampling rate of reconstruction is not changed. decimation an d interpolation to realize pitch scale 4.5 summary 4.5.1 sampling rate reduction by an integer factor 4.5.2 increasing the sampling rate by an integer factor 4.5.3 changing the sampling rate by a noninteger fact 4.5.4 application of multirate signal processing requirement: frequency spectrum chart of interpolation and decimation exercises 4.15 (b)(c) 4.24(a)(b) 4.26 only for ωh= π /4