ELEN E4810: Digital Signal Processing Topic 11: Continuous Signals 1. Sampling and Reconstruction 2. Quantization Dan Ellis 2013-12-04 1 1. Sampling & Reconstruction x(t) DSP must interact with an analog world: A to D ADC x[n] DSP y[n] Anti- Sample alias and filter hold Sensor Dan Ellis D to A y(t) DAC Reconstruction filter WORLD 2013-12-04 Actuator 2 Sampling: Frequency Domain Sampling: CT signal → DT signal by recording values at ‘sampling instants’: Discrete g[n] = ga (nT ) Continuous Sampling period T → samp.freq. ≠samp = 2º/T rad/sec What is the relationship of the spectra? ≠ in rad/second i.e. relate Ga ( j) = and Dan Ellis jt g t e a ( ) dt G(e ) = g[n]e j CTFT jn DTFT ! in rad/sample 2013-12-04 3 Sampling DT signals have same ‘content’ as CT signals gated by an impulse train: ga(t) gp(t) × t t CT delta fn p(t) = n= (t nT ) T t ‘sampled’ signal: still continuous - but discrete values gp(t) = ga(t)·p(t) is a CT signal with the same information as DT sequence g[n] Dan Ellis 2013-12-04 4 Spectra of sampled signals ⇥ Given CT gp (t) = CTFT Spectrum n= ⇥ Gp (j ) = F{gp (t)} = ga (nT ) · (t by linearity ga (nT )F{ (t nT )} n Gp (j ) = Compare to DTFT ga (nT )e ⇥n G(ej ) = g[n]e ⇥n i.e. G(ej ) = Gp (j )| Dan Ellis nT ) T= 2013-12-04 j nT j n ≠ ~ !/T º/T = ≠samp/2 ! ~ ≠T º 5 Spectra of sampled signals Also, note that p(t ) = (t nT ) n is periodic, thus has Fourier Series: 1 ck = T 1 = T 1 j ( 2T ) kt p(t ) = e T k= j2 kt / T p t e dt ( ) T / 2 T /2 shift in But F {e j0 t x (t )} = X ( j ( 0 )) frequency ( so G p ( j) = T1 k Ga j ( k samp ) ) - scaled sum of replicas of Ga(j≠) shifted by multiples of sampling frequency ≠samp Dan Ellis 2013-12-04 6 CT and DT Spectra j 1 k 2 So: G (e = G j = G j ( ) ( ( ) p T = T k a T T )) DTFT G ( e jT ) = 1 CTFT G j k ( ) ( ) T a samp k ga (t ) Ga ( j) −≠M × p(t ) P ( j) = −2≠samp ( ) g[n] G e j Dan Ellis −2º = 2≠samp shifted/scaled copies ≠ 2 samp T 2013-12-04 have = T = 2 At ≠ ≠samp M/T −4º ≠ ≠M −≠samp g p (t ) G p ( j) ↓ ga(t) is bandlimited @ ≠Μ M = 2º 4º 7 ! Avoiding aliasing Sampled analog signal has spectrum: Gp(j≠) Ga(j≠) −≠samp −≠M −≠samp + ≠M ≠M “alias” of “baseband” signal ≠ ≠samp ≠samp− ≠M ga(t) is bandlimited to ± ≠M rad/sec When sampling frequency ≠samp is large... → no overlap between aliases → can recover ga(t) from gp(t) by low-pass filtering Dan Ellis 2013-12-04 8 Aliasing & The Nyquist Limit If bandlimit ≠M is too large, or sampling rate ≠samp is too small, aliases will overlap: Gp(j≠) −≠M −≠samp ≠M ≠samp ≠samp− ≠M ≠ Spectral effect cannot be filtered out → cannot recover ga(t) Sampling theorum Avoid by: samp M M samp 2 M i.e. bandlimit ga(t) at ≤ samp Nyquist 2 frequency Dan Ellis 2013-12-04 9 Anti-Alias Filter To understand speech, need ~ 3.4 kHz → 8 kHz sampling rate (i.e. up to 4 kHz) ‘space’ for Limit of hearing ~20 kHz filter rolloff → 44.1 kHz sampling rate for CDs Must remove energy above Nyquist with LPF before sampling: “Anti-alias” filter A to D ADC Anti-alias Sample filter & hold Dan Ellis 2013-12-04 10 M Sampling Bandpass Signals Signal is not always in ‘baseband’ around ≠ = 0 ... may be at higher ≠: A −≠H −≠L ≠L ≠H ≠ Bandwidth ¢≠ = ≠H − ≠L If aliases from sampling don’t overlap, no aliasing distortion; can still recover: A/T −≠samp ≠samp/2 ≠samp ≠ 2≠samp Basic limit: ≠samp/2 ≥ bandwidth ¢≠ Dan Ellis 2013-12-04 11 Reconstruction To turn g[n] back to g^a(t): g[n] n make a continuous impulse train g^ p(t) lowpass filter to extract baseband → g^ a(t) G(ej!) º ! G^ p(j≠) g^ p(t) t ^ Ga(j≠) ^ ga(t) ≠samp/2 ≠ ≠ t Ideal reconstruction filter is brickwall Dan Ellis i.e. sinc - not realizable (especially analog!) use something with finite transition band... 2013-12-04 12 2. Quantization Course so far has been about discrete-time i.e. quantization of time Computer representation of signals also quantizes level (e.g. 16 bit integer word) Level quantization introduces an error between ideal & actual signal → noise Resolution (# bits) affects data size → quantization critical for compression Dan Ellis smallest data coarsest quantization 2013-12-04 13 Quantization x Quantization is performed in A-to-D: x t A/D n T Quantization has simple transfer curve: 5 Q{x} 4 3 2 1 0 -1 -2 -3 -4 -5 -5 -4 -3 -2 -1 0 1 2 3 4 5 Quantized signal e = x - Q{x} Quantization error e = x xˆ x Dan Ellis xˆ = Q{x} 2013-12-04 14 Quantization noise Can usually model quantization as additive white noise: i.e. uncorrelated with self or signal x x[n] + - ^ x[n] e[n] bits ‘cut off’ by quantization; hard amplitude limit Dan Ellis 2013-12-04 15 Quantization SNR Common measure of noise is Signal-to-Noise ratio (SNR) in dB: signal power 2x SNR = 10 log10 2 dB e noise power When |x| >> 1 LSB, quantization noise has ~ uniform distribution: P(e[n]) 2 e2 = 12 Dan Ellis - / 2 + / 2 (quantizer step = ") 2013-12-04 16 Quantization SNR Now, σx2 is limited by dynamic range of converter (to avoid clipping) e.g. b+1 bit resolution (including sign) output levels vary -2b·" .. (2b-1)" –R R FS ! = ! ! where full-scale range ...! FS b+1 2 2 RFS = 2 SNR = 10 log10 2 x 2 RFS 6b + 16.8 22(b+1) ·12 Dan Ellis i.e. ~ 6 dB SNR per bit 2013-12-04 20 log10 RFS depends on signal 17 x Coefficient Quantization Quantization affects not just signal but filter constants too .. depending on implementation .. may have different resolution Some coefficients are very sensitive to small changes Dan Ellis e.g. poles near unit circle high-Q pole becomes unstable z-plane 2013-12-04 18 12/9 Project Presentations 10:15 Arthur Argall: Genomic Signal Processing 10:25 Yue Hou, Dongxue Liu: Blind Signal Separation 10:35 Nathan Lin: Spectral Domain Phase Microscopy 10:45 Minda Yang, Yitong Li: Reconstruction from Neural Measurements 10:55 Yinan Wu: Mixed Channel Music 11:05 Maja Rudolph, Preston Conley: Walking Pace Extraction from Video 11:15 Alan Zambeli-Ljepović, Tanya Shah, Sophie Wang: Lung Sounds Analysis Dan Ellis 2013-12-04 19