EE 424 #1: Sampling and ReconstructionJanuary 13, 2011ContentsNotation and Definitions2A Review: Signal Manipulations, CT Convolution, CTFT and Its PropertiesSignal manipulationsCT convolution33CTFT and its propertiesPoisson Sum FormulaSampling3577Introduction7Applications8Point and impulse samplingSampling theoremReconstruction81112Ideal Reconstruction: Shannon interpolation formulaIdeal reconstruction: Summary13A general reconstruction filter14Reconstruction with zero-order hold15Examples of sampling and reconstructionComments on Lab 1121924Sampling part of Lab 124Reconstruction part of Lab 125Lowpass reconstruction filtersDT lowpass reconstruction filters2629Reading: EE 224 handouts 2, 16, 18, 19, and lctftsummary (review);§ 1.2.1, § 2.2.2, § 4.3, and § 7.1–§ 7.3 in the textbook1 .A. V. Oppenheim and A. S. Willsky.Signals & Systems. Prentice Hall, UpperSaddle River, NJ, 19971

ee 424 #1: sampling and reconstruction2Notation and DefinitionsDefinition 1. The unit rectangle is defined in Fig. 1.Definition 2. The sinc function is defined assinc( x ) sin(π x )πx(1)see also Fig. 2.Definition 3. An indicator function is defined as:(1, t ( a, b).1(a,b) (t) 0, otherwise(2)Definition 4 (CT impulse). We define the continuous-time (CT) impulseδ(·) by the property thatZ x (t) δ(t) dt x (0)Figure 1: Definition and plot of the unitrectangle.for all x (t) that are continuous at t 0.Figure 2: Plot of the sinc function.

ee 424 #1: sampling and reconstruction3A Review: Signal Manipulations, CT Convolution, CTFT and ItsPropertiesSignal manipulationsPractice examples:Figure 3: Time shift: y(t) x (t t0 ).Where does time t 0 move?Figure 4: Scaling: y(t) x (t/T ) whereT 0.CT convolutionCT convolution is defined asx (t) ? h(t) Z x (τ ) h(t τ ) dτ.Basic CT linear time-invariant (LTI) systems. The time-shift systemy(t) x (t t0 ) is LTI with impulse response δ(t t0 ):x ( t ) ? δ ( t t0 ) x ( t t0 ).Example: Compute y(t) ( x ? h)(t) for x (t) 2 1(0,2) (t) andh(t) 1(0,1) (t).First sketch x (t) and h(t):(3)

ee 424 #1: sampling and reconstruction4Figure 5: Critical time points: t 1 0and t 0 as well as t 1 2 and t 2,i.e. t 0, 1, 2, 3, meaning that we have 5intervals to consider for t.

ee 424 #1: sampling and reconstruction5CTFT and its propertiesX F ( ω ) denotes continuous-time Fourier transform (CTFT)of x ( t ) :XF (ω) x(t) Z 12πx ( t ) e j ω t dtZ X F ( ω ) e j ω t dω(4a)(4b)where ω is the frequency in radians per second (rad/s).Review EE 224 handout lctftsummary to solve the practice examples in Fig. 6.The textbook uses X ( j ω ) to denote theCTFT of x (t).

ee 424 #1: sampling and reconstruction6Figure 6: Examples of CTFT properties.CTFTModulation property: If x (t) X F (ω ), thenCTFTx (t) e j ω0 t X F (ω ω0 )(complex modulation).(5)Generalized modulation property. Find CTFT of a signalx (t) f (t)(6)where f (t) is periodic with fundamental period T0 and fundamentalfrequency ω0 2 π/T0 . First, express f (t) using Fourier series (FS): f (t) k a k e j k ω0 tand substitute this expansion into (6): x (t) k a k e j k ω0 t k CTFTak x (t) e j k ω0 t k a k X F ( ω k ω0 ) .(7)To derive the sampling theorem, we will choose f (t) to be the impulse train, defined in the following.Ideal lowpass filter. The frequency response of the ideal lowpassfilter in Fig. 7 can be written as2H F (ω ) T 1 π/T,π/T (ω )π/Tπ/T t sinct sinc.ππTSee also Definition 3.3See EE 224 handout lctftsummary.(8)and the corresponding impulse response hLP (t) is3h(t) T2(9)

ee 424 #1: sampling and reconstructionFigure 7: An ideal lowpass filter.Poisson Sum FormulaFigure 8: The impulse train pT (t) isdefined as pT (t) δ(t n T )n where T denotes its period.Poisson sum formula. Consider the Fourier-series representationof the impulse train pT (t) in Fig. 8: pT (t) k whereω0 a k e j k ω0 t2πTandak 1TZTpT (t)e j k ω0 t dt Therefore,1T pT (t) k Z T/2 T/2δ(t) e j k ω0 t dt 1 j k ω0 te.T1.T(10)SamplingIntroductionSampling: Conversion of a continuous-time signal (usually not quantized) to a discrete-time signal (usuallyquantized).7

ee 424 #1: sampling and reconstructionReconstruction: Conversion of a discrete-time signal(usually quantized) to a continuous-time signal.Why Sample and Reconstruct? Digital storage (CD, DVD, etc.) Digital transmission (optical fiber, cellular phone, etc.) Digital switching (telephone circuit switch, Internet packet switch,etc.) Digital signal processing (video compression, speech compression,etc.) Digital synthesis (speech, music, etc.).ApplicationsHere is a typical sampling and reconstruction system:Quantization causes “noise,” limiting the signal-to-noise ratio (SNR) to about 6 dB per bit. We mostlyneglect the quantization effects in this class.Point and impulse samplingThere are two ways of looking at the sampled signal: as1. a sequence of numbersx [n] x (n T ), n integerpoint sampling of x (t), depicted in Fig. 9 (b), or8

ee 424 #1: sampling and reconstruction2. a continuous-time signal x P (t) x (n T ) δ(t n T )n impulse sampling of x (t), depicted in Fig. 9 (c).Figure 9: Sampling: (a) CT signal x (t),(b) the point-sampled sequence x [n],and (c) the impulse-sampled signalx P ( t ).9

ee 424 #1: sampling and reconstruction10Point sampling: An actual sampling system mixes continuous and discrete time. Discrete-timex [n] x (n T ) Continuous-time x (t) specified for all n T, n integer. Spectrum X F (ω ) analyzed by CTFT, frequencyvariable ω. Spectrum X f (Ω) analyzed by DTFT, frequencyvariable Ω ω T.Impulse sampling: An equivalent all-CT system. “Continuous-time” signal x P (t) specified for all t, but zero except at t n T. Spectrum XPF (ω ) analyzed using CTFT (which is why we use impulse sampling), withω T ).XPF (ω ) X f ( {z}Ω(11)

ee 424 #1: sampling and reconstruction11Sampling theoremIn this handout, we focus on impulse sampling because itrequires only the knowledge of theory of CT signals and CTFT. 4 Recall the impulse train pT (t) n δ ( t n T ) and define x P (t) x (t) pT (t) x (t) δ(t n T ) n which is formally a CThave x (n T ) δ(t n T ){z }n signal.5(12)By the Poisson sum formula (10), we x P (t) x [n] k 1x ( t ) e j k ω0 t .TSince this is a course on digital signalprocessing, we will turn to DT signalsand point sampling starting handout #2. Then, (11) will be the bridgebetween the CT sampling theory developed in this handout and DT results inthe remainder of the class.4However, it is clear that the information it conveys about x (t) is limited tothe values x (n T ), n integer.5(13)Take CTFT of (13):XPF (ω ) k 11CTFT{ x (t) e j k ω0 t } TTwhereω0 2πT k X F ( ω k ω0 )(14)(rad/s).CTFTFor x (t) X F (ω ) bandlimited to ω ωm , we have:Figure 10: A bandlimited signal spectrum X F (ω ) and the spectrum XPF (ω ) ofthe corresponding sampled signal.CTFTSampling Theorem. Suppose x (t) X F (ω ) bandlimited to ω ωm .

ee 424 #1: sampling and reconstruction If the sampling frequency satisfies6ω0 2 ωm612(15) is known as the Nyquist criterion.(15)as in Fig. 10, no aliasing occurs and we can perfectly reconstruct x (t)from its samplesx [n] x (t) t n T , n 0, 1, 2, . . .or, equivalently, from x P (t). Ifω0 6 2 ωmaliasing occurs and we cannot reconstruct x (t) perfectly from x [n] ingeneral. (In special cases, we can.)ReconstructionAssume that the Nyquist requirement ω0 2 ωm is satisfied. We consider two reconstruction schemes: ideal reconstruction (with ideal bandlimited interpolation), reconstruction with zero-order hold.Ideal Reconstruction: Shannon interpolation formulaRecall (14):XP (t) . . . 1 F11X ( ω ω0 ) X F ( ω ) X F ( ω ω0 ) . . .TTTFigure 11: To reconstruct the originalCT signal x (t), apply an ideal lowpassfilter to the impulse-sampled signalx P ( t ) x ( t ) p T ( t ).Our ideal reconstruction filter has the frequency response:H F (ω ) T 1( π/T,π/T ) (ω )

ee 424 #1: sampling and reconstruction13and, consequently, the impulse response [see (9)]h(t) sinct .TFigure 12: An equivalent all-CT reconstruction system.Now, the reconstructed signal is x (t) x P (t) {z }? h(t) impulse-sampled signal x (n T ) δ(t n T ) ? h(t) x (n T ) sinc {z}n n h(t n T ), see (3)which is the Shannon interpolation (reconstruction) formula. The actualreconstruction system mixes continuous and discrete time. The reconstructed signal xr (t) is a train of sinc pulses scaled by thesamples x [n]. This system is difficult to implement because each sinc pulse extends over a long (theoretically infinite) time interval.Ideal reconstruction: Summary Easy to analyze. Hard to implement. Based on bandlimited sinc pulses. t n T T

ee 424 #1: sampling and reconstruction14Figure 13: The interpolated signal isa sum of shifted sincs, weighted bythe samples x (n T ). The sinc functionh(t) sinc t/T shifted to n T, i.e.h(t T ), is equal to one at n T and zeroat all other samples l T, l 6 n. The sumof the weighted shifted sincs will agreewith all samples x (n T ), n integer.A general reconstruction filterFor the development of the theory, it is handy to consider theimpulse-sampled signal x P (t) and its CTFT.Figure 14: Reconstruction in the frequency domain is lowpass filtering.F ( ω ) in Fig. 14 may not be a freHLPquency response of an ideal lowpassfilter, in contrast with H F (ω ) in Fig. 11.

ee 424 #1: sampling and reconstruction15Here, the reconstructed signal is xr (t), with CTFTFXrF (ω ) HLP(ω ) XPF (ω )sampling th. FHLP(ω )1T 2πk XF ω .T}k {z k ω0CTFTF ( ω ) can be made moreNote: As sketched in Fig. 14, hLP (t) HLPflexible than the ideal sinc/boxcar pair; yet, we can still achieve perfect reconstruction. The more we sample above the Nyquist rate, themore flexibility we gain in terms of designing this filter. An exampleof a more flexible filter is given in Fig. 15.Figure 15: Frequency response of aflexible lowpass reconstruction filter.If ωm ω0 /2, then this frequencyresponse reduces to the standard boxcarfrequency response.Reconstruction with zero-order hold Many practical reconstruction systems use zero-orderhold circuits for reconstruction. Why? Rectangular pulses are (much) easier to generate than (approximate) sinc pulses. Replace the ideal sinc with a rectangular pulse7hZOH (t) rectyielding7See Definition 1. t 0.5 T T xZOH (t) n x [n] hZOH (t n T ).Frequency response of the zero-order hold:FHZOH(ω ) Z T0recall ω0 2 π/T and (1).e j ω t dt ω T ω 1 e j ω T j π ωω0 T since j 0.5 ω T T sincejω2πω0(16)

ee 424 #1: sampling and reconstruction16Reconstruction system (mixes continuous and discrete time).Figure 16: The zero-order hold output xZOH (t) is a train of rectangularpulses scaled by the samples x [n] (astaircase approximation of x (t)), easy togenerate. Rewrite the zero-order hold output as xZOH (t) n x [n] hZOH (t n T ) n x [n] hZOH (t) ? δ(t n T ){z} see (3) hZOH (t) ? x [n] δ(t n T )n hZOH (t) ? [ x (t) δ(t n T ) ]n {zp T (t)} hZOH (t) ? x P (t).Now, take CTFT of (17):FFXZOH(ω ) HZOH(ω ) XPF (ω )sampling th. FHZOH(ω )1T k X F ( ω k ω0 ) .

ee 424 #1: sampling and reconstruction17Finally, the output of the reconstruction filter has the following spectrum [see (16)]:FFXrF (ω ) HrF (ω ) XZOH(ω ) HrF (ω ) HZOH(ω ) XPF (ω ) HrF (ω ) {z }reconstructionfilter We can reconstruct the signal perfectly, i.e.CTFT xr ( t ) x ( t )XrF (ω ) X F (ω )if the Nyquist criterion is satisfied and we can design a reconstruction filter with the following frequency response:HrF (ω ) ejπωω0 sinc ωω0 {z }compensates ZOHincluding delay (hence not causal)· 1( ω0 /2,ω0 /2) (ω ) . {z}removes copiesk 6 0 ω j π ωω 10T sinceω0T {z} sinc with phase factorfrom the ZOH circuit k X F ( ω k ω0 ) .{zshifted copiesfrom sampling}

ee 424 #1: sampling and reconstruction18

ee 424 #1: sampling and reconstructionWe achieve flexibility in designing HrF (ω ) by utilizing a samplingrate that is significantly higher than the Nyquist rate, which providesa guard band.We can boost the sampling rate by digital interpolation — you willsee how to do that in Lab 1 and learn the theory later in class.Examples of sampling and reconstructionIn practice, we often use one of the standard analog lowpass filtershaving order 2 to 10 (or so) as reconstruction filters HrF (ω ). The lasttwo of the following examples use a second-order analog Butterworthfilter with cutoff frequency ωc ω0 /2.First, recall Fig. 10.19

ee 424 #1: sampling and reconstruction20

ee 424 #1: sampling and reconstruction21

ee 424 #1: sampling and reconstruction22

ee 424 #1: sampling and reconstruction23

ee 424 #1: sampling and reconstruction24Comments on Lab 1Sampling part of Lab 1Basic fact: A bandlimited signal with bandwidth f m (inHz) can be reconstructed perfectly from its samples if the samplingrate f 0 1/T is twice the signal bandwidth (or more): f 0 2 f m .Typically, we think of sampled sinusoids as looking like that inFig. 17.Figure 17: Sampled sinusoid. At thissampling rate, it is easy to believe thatwe can reconstruct the sinusoid from itssamples.Most sampled sinusoids are much less recognizable:Figure 18: Sinusoid sampled at a muchlower sampling rate.Conclusion: The fact that the signal was bandlimited beforesampling is a very powerful constraint in the reconstruction of thecontinuous-time signal.

ee 424 #1: sampling and reconstructionFigure 19: Continuous-time model ofthe reconstruction of a discrete-timesignal.Reconstruction part of Lab 1How important is the lowpass filter response of the reconstruction filter in Fig. 19? You will look at the improvement in reconstruction as you go from a very simple lowpass filter tohigher-performance lowpass filters.Basic Problem: You have one second of a 200 Hz sinusoid, sampled at 1024 Hz. You want to reconstruct it as accurately as possible.Since everything in Matlab is inherently discrete time, we willconsider a closely related problem. We start with a 200 Hz sinusoid sampled at 8192 Hz. If we take every eighth sample (subsampling, or decimating by afactor of eight), we have the 200 Hz sinusoid sampled at 1024 Hz. We then wish to recover the 7/8ths of the samples we threw away.Conceptually, the 8192 Hz sampling rate is so high that we can consider the sampled 200 Hz sinusoid to be continuous.The 8192 Hz sampling rate was chosen so that the signals wouldall be in the audio range. This is the sampling rate that Matlabassumes for sound — you can play and hear the reconstructions.The first 16 ms of the 1024 Hz sampled signal look like this:25

ee 424 #1: sampling and reconstruction26This is sampled well above the Nyquist rate, which is 400 Hz. Simpleinterpolation methods will not be adequate.Lowpass reconstruction filtersOne-sample zero-order hold:Figure 20: Convolution with a onesample wide (at 1024 Hz) rect() function.Common approach, often followed by an additional reconstructionfilter HrF (ω ) to correct for the passband frequency response of therect() and suppress sidelobes at multiples of ω0 (in rad/s), see theearlier discussion in this handout.Linear interpolation:This has better suppression of the sidelobes and more passbanddistortion than the rect().Ideally, we wish to use the perfect filter with a sinc() impulse response. This is not practical, so instead we approximate the infiniteduration sinc by a segment that we extract with a window function.

ee 424 #1: sampling and reconstruction27Figure 21: Convolution with a twosample wide (at 1024 Hz) wedge()function.Figure 22: The rect() and wedge()filters are zero- and first-order approximations to the sinc.Figure 23: Approximate interpolation:Convolution with a windowed sinc.

ee 424 #1: sampling and reconstruction28Figure 24: First case: A 4-samplewindowed sinc (at 1024 Hz sampling).Figure 25: Second case: An 8-samplewindowed sinc (at 1024 Hz sampling).

ee 424 #1: sampling and reconstructionDT lowpass reconstruction filtersIn Lab 1, we will do the filtering in discrete time usingsampled versions of the filters, and the convolution sum.What we actually do here is upsampling or discrete-time interpolation:the sampling rate is increased by a factor of M in discrete time, inorder to reduce the demands of the D/A conversion. This allows usto use a very simple D/A converter. We will come back to this laterat the end of semester.29

ee 424 #1: sampling and reconstructionThis is commonly done in CD players, where the data sampling rateis 44.1 kHz. This rate is upsampled by a factor of 8 to 352.8 kHz. Bydoing so, the need for correction of the ZOH passband distortion iseffectively eliminated.ReferencesA. V. Oppenheim and A. S. Willsky. Signals & Systems. Prentice Hall,Upper Saddle River, NJ, 1997.30

Digital signal processing (video compression, speech compression, etc.) Digital synthesis (speech, music, etc.). Applications Here is a typical sampling and reconstruction system: Quantization causes “noise,” limiting the signal-to-noise ratio (SNR) to about 6 dB per bit. We mostly neglect the quantization effects in this class.