6 Sampling Bridge between continuous time and discrete time signals Sampling theorem complete representation of a continuous time signal by its samples Samplingandreconstruction implementcontinuous timesystems and process continuous time signals using discrete time signal technology Useful tool for efficient discrete-time processing x(t) A D x[n] Discrete-time processing y[n] D A y(t) Outline 6. he Sampling heorem 6.2 Reconstruction 6.3 he Effect of Undersampling: Aliasing 6.4 Discrete ime Processing of Continuous ime Signals 6.5 Sampling of Discrete ime Signals he University of British Columbia c Ali Bashashati
6. he Sampling heorem 6. he Sampling heorem Objective: Representation of a continuous-time signal by samples x(t) t Unique? x(t) t Observation: An infinite number of signals can generate a given set of samples. We need additional constraints on continuous-time signal! he University of British Columbia c Ali Bashashati 2
6. he Sampling heorem 6.. Impulse rain Sampling Representation of sampling of continuous time signal Sampling property of unit impulse x(t)δ(t t 0 ) = x(t 0 )δ(t t 0 ) Sampling at regular intervals spaced by periodic impulse train p(t) = δ(t n) n=...... 0 2 t Mechanism: impulse train sampling Impulse train x p (t) = x(t)p(t) x p (t) = n= x(n)δ(t n) Amplitudes of impulses = samples of x(t) Notation p(t): sampling function : sampling period s = /: sampling frequency he University of British Columbia c Ali Bashashati 3
6. he Sampling heorem Illustration: p(t) x(t) x p (t) x(t) t p(t) 0 2 3 4 5 x p (t) x(3) x(4) t t he University of British Columbia c Ali Bashashati 4
6. he Sampling heorem Sampling function p(t) = n= δ(t n)...... t Periodic continuation P(j) = n= ( δ n ) = n= δ( n s )... s... he University of British Columbia c Ali Bashashati 5
6. he Sampling heorem Spectrum of sampled signal Multiplication property x p (t) = x(t) p(t) = F X p (j) = X(j) P(j) = Illustration X(j) n= n= x(n)δ(t n) X(j( n s )) M M...... s 0 = X p (j) s...... s M M s Observe superposition of shifted (n s ) and scaled ( ) replicas periodic with s = duality: periodic signal impulse-train spectrum F sampled signal periodic spectrum F he University of British Columbia c Ali Bashashati 6
6. he Sampling heorem Reconstruction with lowpass filter H(j) x p (t) H(j) x r (t) Case : s > 2 M X p (j) H(j)...... s M M s Reconstruction filter H(j): x r (t) = x(t) H(j) =, M 0, ( s M ) don t care, else Case 2: s < 2 M X p (j)...... 2 s s s 2 s Overlap between the shifted replicas of X(j) (Aliasing) x r (t) x(t) he University of British Columbia c Ali Bashashati 7
6. he Sampling heorem Sampling heorem Let x(t) be a band-limited signal with X(j) = 0 for > M. hen x(t) is uniquely determined by its samples x(n), n Z, if s > 2 M, where s =. Reconstruction of x(t) from samples x(n) Generate periodic impulse train x p (t) = x(n)δ(t n) n= Pass impulse train through ideal lowpass filter with gain and cutoff frequency M < c < s M. Critical sampling Undersampling s = 2 M Nyquist rate f s = = M π s < 2 M Aliasing In practical application: he ideal lowpass filter would be replaced by a nonideal filter leading to an (acceptable) discrepancy between x(t) and the reconstructed signal x r (t). he University of British Columbia c Ali Bashashati 8
6. he Sampling heorem Historical notes J.L. Lagrange around 765, C.J. de la Vallée Poussin 908 Interpolation using sin(x) and sinc(x) E.. Whittaker 95 Interpolation for arbitrary band-limited functions using sinc(x) V.A. Kotel nikov 933, H. Raabe 939 Statement of sampling theorem for communication problems C.E. Shannon 949 Popularization of sampling theorem in communication theory Someya 949 In Japan he University of British Columbia c Ali Bashashati 9
6. he Sampling heorem 6..2 Nonideal Sampling Sampling procedure requires energy taken from signal x(t), e.g., Charging capacitor Exposing film Model sampling as concatenation of aperture filtering and impulsetrain sampling p(t) x(t) H a (j) x (t) x p (t) Describe nonideal sampling, e.g., collection of charge over a time τ, as integration ( ) t h a (t) = rect τ Illustration x(t) Integration t τ he University of British Columbia c Ali Bashashati 0
Integrated signal 6. he Sampling heorem ) Sampled signal x (t) = x(t) h a (t) = x(t) ( t τ rect τ ( τ ) X (j) = X(j) sinc x p (t) = x (t)p(t) X p (j) = Effects in frequency domain ( X(j) sinc Distortion of spectrum X(j) ( τ )) P(j) X(j) sinc ( ) τ, τ = 2 4π π π 4π he University of British Columbia c Ali Bashashati
6.2 Reconstruction 6.2 Reconstruction Derivation of sampling theorem reconstruction of x(t) from samples x(n) by Generation of weighted impulse train and Subsequent ideal lowpass filtering Ideal reconstruction p(t) x(t) x p (t) H(j) x r (t) Ideal lowpass filter ( ) H(j) = rect 2 c F h(t) = c π sinc ( ) c t π with cut-off frequency M < c < s M ime domain x r (t) = x p (t) h(t) [ ] = x(n)δ(t n) x r (t) = n= n= x(n) c π sinc Ideal band-limited interpolation c π sinc ( ) c (t n) π ( ) c t π he University of British Columbia c Ali Bashashati 2
6.2 Reconstruction c = s /2 x r (t) = n= x(n)sinc ( ) t n 2 2 t Practical issues Narrow, large-amplitude pulses difficult to generate Ideal lowpass filtering impossible Nonideal, practical reconstruction the zero-order hold Hold value x(n) until the next sample x r (t) 2 t x(t) he University of British Columbia c Ali Bashashati 3
6.2 Reconstruction Reconstructed signal ( t n x r (t) = x(n)rect n= 2 ) = x p (t) rect ( t ) 2 Observe: convolution of impulse-sampled signal x p (t) with ( t h 0 (t) = rect ) 2 or multiplication of X p (j) with ( ) H 0 (j) = sinc e j/2 F h 0 (t) Model of zero-order hold as impulse-train sampling followed by an LI system p(t) x(t) x p (t) H 0 (j) x r (t) Zero order hold Spectrum of reconstructed signal ( ) X r (j) = X p (j)sinc = X(j( n s ))sinc n= e j/2 ( ) e j 2 he University of British Columbia c Ali Bashashati 4
... X p (j) sinc ( ) 6.2 Reconstruction... s M M X r (j) s...... s M M s Effects of the zero-order hold Linear phase shift corresponding to a time delay of /2 Distortion of the portion of X p (j) between M and M Distorted and attenuated versions of the images of X(j) Reduce/eliminate effects of distortion and aliasing by continuoustime compensation filter H c (j) = Anti-imaging filter sinc(/()), M 0, ( s M ) don t care, else x(n) Zero order hold Anti imaging filter x r (t) he University of British Columbia c Ali Bashashati 5
6.2 Reconstruction Other nonideal interpolation procedures Linear interpolation (first-order hold) x r (t) 2 t x(t) Interpolation filter h (t) h (t) with transfer function is H (j) = sinc t ( ) 2 Reconstructed signal continuous with discontinuous derivatives Second- and higher order holds higher degree of smoothness he University of British Columbia c Ali Bashashati 6
6.2 Reconstruction Comparison of transfer functions for interpolation H(j) Ideal interpolation filter First-order hold Zero-order hold s s 2 0 s 2 s he University of British Columbia c Ali Bashashati 7
6.3 he Effect of Undersampling: Aliasing 6.3 he Effect of Undersampling: Aliasing If condition of sampling theorem is not met, s < 2 M, then spectrum of x(t) not replicated in X p (j) x(t) not recoverable by lowpass filtering Individual terms in X p (j) = k= overlap referred to as aliasing. X(j( k s )) X p (j)...... 2 s s s 2 s Lowpass filtering with c = s /2 for reconstruction ( ) s (t n) x r (t) = x(n)sinc n= x r (t) not equal to x(t), but x r (nt) = x(nt), n Z he University of British Columbia c Ali Bashashati 8
6.3 he Effect of Undersampling: Aliasing Example: Critical sampling of sinusoidal signal x(t) = cos( 0 t+φ) Sampling at exactly twice the frequency of the sinusoid Spectra s = 2 0 X(j) = π ( e jφ δ( s /2)+e jφ δ( + s /2) ) X p (j) = π k= = π 2 cos(φ) ( e jφ δ( s /2 k s )+e jφ δ( + s /2 k s ) ) π 2 e jφ k= δ( s /2 k s ) X(j) π 2 ejφ 0 = s 2 X p (j) 0 = s 2 π cos(φ) s s 2 s 2 s 2 s he University of British Columbia c Ali Bashashati 9
6.3 he Effect of Undersampling: Aliasing Reconstruction with ideal lowpass filter with cutoff frequency s /2 < c < s + s /2 and gain X r (j) = π 2 cos(φ)(δ( s/2)+δ( + s /2)) and x r (t) = cos(φ)cos( s t/2) Obviously, x(t) = x r (t) only if φ = n, n Z Otherwise, x r (t) not equal x(t) E.g., φ = π/2 x(t) = sin( s t/2) x r (t) = 0 Note Sampling theorem explicitly requires that the sampling frequency be greater than twice the highest frequency in the signal, rather than greater than or equal to twice the highest frequency. his subtle difference is important for signals whose spectra captureenergyat = ± M,i.e., whosespectraincludeδ(± M ). If s = 2 M is chosen for such signals, additional phase information is required for correct reconstruction (see previous example). he University of British Columbia c Ali Bashashati 20
6.4 Discrete-ime Processing of Continuous-ime Signals 6.4 Discrete-ime Processing of Continuous-ime Signals Often: discrete-time signal processing preferred Decompose continuous-time system in cascade of three operations x c (t) Conversion to x d [n] Discrete-time y d [n] Conversion to y c (t) discrete time system continuous time Continuous-time input x c (t) and output y c (t) Corresponding discrete-time signals x d [n] and y d [n] heoretical basis for conversion: Sampling theorem Continuous-to-discrete-time conversion (C/D conversion) (sampling with sampling period ) x d [n] = x c (n) Discrete-time to continuous-time conversion (D/C conversion)) (reconstruction) y d [n] = y c (n) x c (t) C/D conversion x d [n] = x c (n) Discrete-time system y d [n] = y c (n) D/C conversion y c (t) Digital systems analog-to-digital (A-to-D) and digital-to-analog (D-to-A) converter, respectively he University of British Columbia c Ali Bashashati 2
6.4 Discrete-ime Processing of Continuous-ime Signals Model for C/D conversion: periodic sampling + mapping of impulse train to sequence p(t) C/D conversion x c (t) x p (t) Conversion of impulse train to discrete-time sequence x d [n] Impulse train x p (t) with amplitudes x c (n) and time spacing equal sampling period Discrete-time sequence x d [n] with amplitudes x c (n) and unity spacing in terms of variable n x p (t) = x p (t) = 2 0 2 t 0 2 t x d [n] x d [n] 2 0 2 3 n 2 0 2 3 n he University of British Columbia c Ali Bashashati 22
6.4 Discrete-ime Processing of Continuous-ime Signals Relation in frequency domain Distinguish (only in this section) Continuous-time frequency variable Discrete-time frequency variable Ω Continuous-time sampled signal x p (t) = x c (n)δ(t n) Spectrum X p (j) = Discrete-time signal x d [n] Spectrum X d (e jω ) = n= Relation between spectra n= n= x d [n] = x c (n) x d [n]e jωn = X d (e jω ) = X p (j) x c (n)e jn n= =Ω/ From X p (j) = k= X c(j( k s )) x c (n)e jωn X d (e jω ) = k= X c (j(ω k)/) he University of British Columbia c Ali Bashashati 23
6.4 Discrete-ime Processing of Continuous-ime Signals Illustration for different sampling rates = = 2 = 2 X c (j) X c (j) 0 0 X p (j) X p (j) 2 0 0 2 2 X d (e jω ) X d (e jω ) 2 0 Ω 0 Ω Observe Spectrum X d (e jω ) is frequency-scaled version of X p (j). X d (e jω ) is periodic in Ω with period. Frequency scaling by = normalization with sampling interval Consistent withtime scaling by / in converting from x p (t) to x d [n] he University of British Columbia c Ali Bashashati 24
6.4 Discrete-ime Processing of Continuous-ime Signals Model for D/C conversion: generate continuous-time impulse train + lowpass filtering D/C conversion y d [n] Conversion of discrete-time sequence to impulse train y p (t) s 2 s 2 y c (t) Impulsetrainy p (t)withamplitudesy d [n]andtimespacingequal sampling period Lowpass filter with cut-off frequency c = s /2 Overall system and digital processing p(t) H c (j) x c (t) x p (t) Conversion of impulse train to discrete-time sequence x d [n] H d (e jω ) y c (t) s 2 s 2 y p (t) Conversion of discrete-time sequence to impulse train y d [n] he University of British Columbia c Ali Bashashati 25
6.4 Discrete-ime Processing of Continuous-ime Signals Conditions of sampling theorem satisfied + discrete-time identity system overall continuous-time identity system Frequency-domain consideration for representative example Some general frequency response H d (e jω ) No aliasing, s > 2 M Spectra X c (j), X p (j), and X d (e jω ) X c (j) M 0 M X p (j) s M 0 M s X d (e jω ) s M 0 M s = Ω he University of British Columbia c Ali Bashashati 26
6.4 Discrete-ime Processing of Continuous-ime Signals Discrete-time filtering Y d (e jω ) = H d (e jω )X d (e jω ) Conversion to continuous-time impulse train Y p (j) = Y d (e j ) = H d (e j )X d (e j ) = H d (e j )X p (j) = H d (e j ) Continuous-time lowpass filtering Illustration Y c (j) = H d (e j )X c (j) A H d (e jω ), X d (e jω ) k= X c (j( k s )) Ω c 0 Ω c M M Ω A H p (j), X p (j) s M Ω c 0 Ω c M s A H c (j), X c (j) M Ω c 0 Ω c M he University of British Columbia c Ali Bashashati 27
6.4 Discrete-ime Processing of Continuous-ime Signals Observation: For sufficiently band limited inputs (sampling theorem is satisfied) the overall continuous-time system is an LI system with frequency response H c (j) = { Hd (e j ), < s /2 0, > s /2 Illustration for previous example A H d (e jω ) Ω c 0 Ω c Ω H c (j) A Ω c 0 Ω c Note: Multiplication by impulse train is time-variant in general, overall system is time-variant Only in the absence of aliasing, overall system is equivalent to a continuous-time LI system. he University of British Columbia c Ali Bashashati 28
6.4 Discrete-ime Processing of Continuous-ime Signals Example:. Digital Differentiator Discrete-time implementation of a continuous-time band-limited differentiating filter Frequency response of continuous-time band-limited differentiating filter with cutoff frequency c { j, < c H c (j) = 0, > c j c H c (j) c c j c Sampling frequency s = 2 c, sampling period = π/ c Corresponding discrete-time transfer function H d (e jω ) = j Ω = j cω π, Ω < π j c H d (e jω ) π π Ω j c he University of British Columbia c Ali Bashashati 29
6.4 Discrete-ime Processing of Continuous-ime Signals Impulse response h d [n] of the discrete-time filter? Continuous-time sinc input ) x c (t) = ( t sinc ( ) X c (j) = rect (band limited to π/ < < π/ no aliasing when sampling at frequency s = /) yields discrete-time input x d [n] = x c (n) = δ[n] (sampling at zeros of sinc function) Since continuous-time output of the digital differentiator we have y c (t) = d dt x c(t) = cos(πt/) t y d [n] = y c (n) = sin(πt/) πt 2 ( ) n n 2, n 0 0, n = 0 Impulse response of discrete-time filter ( ) n h d [n] = y d [n] = n, n 0 0, n = 0 he University of British Columbia c Ali Bashashati 30
6.4 Discrete-ime Processing of Continuous-ime Signals 2. Half-Sample Delay Discrete-time implementation of a time shift(delay) of a continuoustime signal y c (t) = x c (t ) Frequency response of continuous-time delay system for band limited inputs ( ) H c (j) = e j rect 2 c Sampling frequency s = 2 c, sampling period = π/ c Corresponding discrete-time frequency response H d (e jω ) = e jω /, Ω < π H c (j) H d (e jω ) c c π π Ω H c (j) H d (e jω ) c π c c Ω π he University of British Columbia c Ali Bashashati 3
6.4 Discrete-ime Processing of Continuous-ime Signals Note Band-limited input output of system with H c (j) is a delayed replica of input Only for / Z the sequence y d [n] is a delayed replica of x d [n] y d [n] = x d [n /] For / / Z Use relations x d [n] = x c (n), y d [n] = y c (n), y c (t) = x c (t ) E.g. / = /2 (half-sample delay) x c (t) x d [n] = x c (n) 0 2 t y c (t) = x c (t /2) y d [n] = y c (n) = x c ((n /2)) 0 2 t he University of British Columbia c Ali Bashashati 32
6.4 Discrete-ime Processing of Continuous-ime Signals Impulse response h d [n] of discrete-time filter in half-sample delay? Continuous-time sinc input (as in previous example) x c (t) = ( ) t sinc yields discrete-time input x d [n] = x c (n) = δ[n] From continuous-time output of half-delay system y c (t) = x c (t /2) = ( ) t /2 sinc we have y d [n] = y c (n) = sinc(n /2) Impulse response of discrete-time filter h[n] = sinc(n /2) he University of British Columbia c Ali Bashashati 33
6.5 Sampling of Discrete ime Signals 6.5 Sampling of Discrete ime Signals Sampling mechanism also applicable to discrete-time signals 6.5. Impulse-rain Sampling Sequencex p [n]resultingfromsamplingwithsamplingperiod N IN x p [n] = { x[n], if n = an integer multiple of N 0, otherwise Representation by means of discrete-time impulse train p[n] = δ[n kn] k= with Fourier transform (sampling frequency s = /N) P(e j ) = δ( k s ) N Impulse-train sampling k= p[n] x[n] x p [n] x p [n] = x[n]p[n] = k= x[kn]δ[n kn] he University of British Columbia c Ali Bashashati 34
6.5 Sampling of Discrete ime Signals Illustration x[n] N 0 N n p[n] N 0 x p [n] N n N 0 N n Frequency domain (multiplication property) x p [n] = x[n] p[n] = F X p (e j ) = k= P(e jθ )X(e j( Θ) )dθ = N N k=0 x[kn]δ[n kn] X(e j( k s) ) he University of British Columbia c Ali Bashashati 35
6.5 Sampling of Discrete ime Signals Sampling frequency Case : s > 2 M no aliasing X(e j ) M N 0 M P(e j ) s 0 s N X p (e j ) s M 0 M s Case 2: s < 2 M aliasing N X p (e j ) s he University of British Columbia c Ali Bashashati 36
6.5 Sampling of Discrete ime Signals Ideal reconstruction p[n] x[n] x p [n] H(e j ) x r [n] Lowpass filter H(e j ) with gain N and cutoff frequency M < c < s M Impulse response h[n] = N ( c π sinc c n ) π Reconstructed sequence x r [n] = k= x r [n] = x p [n] h[n] x[kn] N c π sinc Ideal band-limited interpolation ( ) c (n kn) π s < 2 M Aliasing no perfect reconstruction possible But for c = s /2 x r [kn] = x[kn], k Z he University of British Columbia c Ali Bashashati 37
6.5 Sampling of Discrete ime Signals s > 2 M No aliasing x r [n] = x[n] X(e j ) M 0 M N X p (e j ) s M 0 M H(e j ) N s s s 2 2 X r (e j ) M 0 M Nonideal reconstruction interpolating filter with impulse response h r [n] x r [n] = x[kn]h r [n kn] k= he University of British Columbia c Ali Bashashati 38
6.5 Sampling of Discrete ime Signals Example: Sequence x[n] with Fourier transform Lowest possible sampling rate? X(e j ) = 0 for 9 π s = N 2 M = 2 ( ) 9 N 9/2 N max = 4 and s,min = π/2 6.5.2 Discrete-ime Decimation and Interpolation Apparently: Zeros in sampled sequence x p [n] redundant (as long as N is known) New sequence x b [n] x b [n] = x p [nn] = x[nn] Extracting every Nth sample Decimation (see Chapter 5, pp. 53-55). he University of British Columbia c Ali Bashashati 39
6.5 Sampling of Discrete ime Signals Relationship between x[n], x p [n], and x b [n] x[n] 0 N n x p [n] 0 N n... x b [n]... Frequency domain description X b (e j ) = x b [k]e jk = n=kn = k= n=integer multiple of N 0 n k= x p [n]e jn/n = x p [kn]e jk n= X b (e j ) = X p (e j/n ) = N X(e j(/n ks) ) N k=0 (compare with Chapter 5, p. 53) x p [n]e jn/n he University of British Columbia c Ali Bashashati 40
6.5 Sampling of Discrete ime Signals Illustration X(e j ) M 0 M π N X p (e j ) M M π N X b (e j ) N M N M π Appropriately band-limited signal x[n] (no aliasing) Effect of decimation is to spread the spectrum of the original sequence over a larger portion of the frequency band. Decimation also referred to as downsampling he University of British Columbia c Ali Bashashati 4
6.5 Sampling of Discrete ime Signals Reverse operation interpolation or upsampling Obtain x[n] from x b [n] Insert zeros in x b [n] x p [n] Lowpass filtering of x p [n] x b [n] Conversion of Ideal lowpass decimated sequence filter to sampled sequence H(e j ) x[n] Illustration, N = 2 x b [n] X b (e j ) A n π 0 π x p [n] H(e j ) X p (e j ) A x[n] n π π 2 0 π π 2 X(e j ) 2A n π 0 π he University of British Columbia c Ali Bashashati 42
6.5 Sampling of Discrete ime Signals Example: Interpolation and decimation for compact sampling without aliasing Sequence x[n] with Fourier transform X(e j ) X(e j ) 9 π 9 π Maximum sampling period without incurring aliasing: N max = 4, s,min = /4 Decimation by a factor of 4 sequence x b [n] with spectrum X b (e j ) X b (e j ) π 0 π 8π 9 However: maximum possible downsampling achieved if entire band from π to π is filled. Room for further downsampling, since X b (e j ) = 0 for 8π/9 < < π 8π 9 he University of British Columbia c Ali Bashashati 43
6.5 Sampling of Discrete ime Signals Problem: desired N max = 9/2 / IN Solution: First upsample by a factor of 2, x[n] x u [n] hen downsample by a factor of 9, x u [n] x ub [n] Spectrum X u (e j ) of upsampled signal x u [n] X ub (e j ) π 9 π 9 π π Spectrum X ub (e j ) of upsampled signal x ub [n] X ub (e j ) π 0 π Observe: Combination effectively results in downsampling x[n] by a noninteger number 9/2. If x[n] represents unaliased samples of continuous-time signal x c (t) x ub [n] represents the maximum possible (aliasing-free) downsampling of x c (t) he University of British Columbia c Ali Bashashati 44