Analog & Digital Signals
Total Page:16
File Type:pdf, Size:1020Kb
AnalogAnalog && digitaldigital signalssignals Analog Digital Continuous function V of Discrete function Vk of continuous variable t (time, discrete sampling variable tk, space etc) : V(t). with k = integer: Vk= V(tk). 0.3 0.3 0.2 0.2 0.1 0.1 0 0 Voltage [V] Voltage [V] Voltage [V] -0.1 -0.1 ts ts -0.2 -0.2 0246810 0246810 time [ms] sampling time, tk [ms] Uniform (periodic) sampling. Sampling frequency fS = 1/ tS Slides adapted from ME Angoletta, CERN DigitalDigital vsvs analoganalog proc’ingproc’ing Digital Signal Processing (DSPing) Advantages Limitations • More flexible. • A/D & signal processors speed: wide-band signals still difficult to • Often easier system upgrade. treat (real-time systems). • Data easily stored. • Finite word-length effect. • Better control over accuracy • Obsolescence (analog requirements. electronics has it, too!). • Reproducibility. Slides adapted from ME Angoletta, CERN DigitalDigital systemsystem exampleexample DOMAIN DOMAIN V ANALOG ANALOG General scheme ms Filter V Antialiasing Sometimes steps missing ms A/D DOMAIN DIGITAL DOMAIN - Filter + A/D A DIGITAL (ex: economics); k - D/A + filter Digital Processing (ex: digital output wanted). A k V D/A DOMAIN DOMAIN ANALOG ANALOG ms V Filter Reconstruction ms Slides adapted from ME Angoletta, CERN DigitalDigital systemsystem implementationimplementation KEY DECISION POINTS: ANALOG INPUT Analysis bandwidth, Dynamic range Antialiasing • Pass / stop bands. Filter 1 • Sampling rate. A/D • No. of bits. Parameters. 2 Digital Processing • Digital format. 3 What to use for processing? See slide “DSPing aim & tools” DIGITAL OUTPUT Slides adapted from ME Angoletta, CERN 1 SamplingSampling How fast must we sample * a continuous signal to preserve its info content? Ex: train wheels in a movie. 25 frames (=samples) per second. Train starts wheels ‘go’ clockwise. Train accelerates wheels ‘go’ counter-clockwise. Why? Frequency misidentification due to low sampling frequency. * Sampling: independent variable (ex: time) continuous → discrete. Quantisation: dependent variable (ex: voltage) continuous → discrete. Here we’ll talk about uniform sampling. Slides adapted from ME Angoletta, CERN 1 SamplingSampling -2-2 1.2 1 __ 0.8 s(t) = sin(2πf0t) 0.6 0.4 s(t) @ fS 0.2 0 f0 = 1 Hz, fS = 3 Hz -0.2 tt -0.4 -0.6 -0.8 __ -0.8 s1(t) = sin(8πf0t) -1 -1.2 -1.2 __ s2(t) = sin(14πf0t) s(t) @ fS represents exactly all sine-waves sk(t) defined by: sk (t) = sin( 2π (f0 + k fS) t ) , ⏐k ⏐∈ Slides adapted from ME Angoletta, CERN 1 TheThe samplingsampling theoremtheorem A signal s(t) with maximum frequency fMAX can be Theo* recovered if sampled at frequency fS > 2 fMAX . * Multiple proposers: Whittaker(s), Nyquist, Shannon, Kotel’nikov. Naming gets confusing ! Nyquist frequency (rate) fN = 2 fMAX or fMAX or fS,MIN or fS,MIN/2 Example s(t) = 3⋅cos(50 π t) +10⋅sin(300 π t) − cos(100π t) Condition on fS? F1 F2 F3 f > 300 Hz F1=25 Hz, F2 = 150 Hz, F3 = 50 Hz S fMAX Slides adapted from ME Angoletta, CERN 1 FrequencyFrequency domaindomain (hints)(hints) • Time & frequency: two complementary signal descriptions. Signals seen as “projected’ onto time or frequency domains. Example Ear + brain act as frequency analyser: audio spectrum split into many narrow bands low-power sounds detected out of loud background. • Bandwidth: indicates rate of change of a signal. High bandwidth signal changes fast. Slides adapted from ME Angoletta, CERN 1 SamplingSampling low-passlow-pass signalssignals Continuous spectrum (a) (a) Band-limited signal: frequencies in [-B, B] (fMAX = B). -B 0 B f (b) Discrete spectrum No aliasing (b) Time sampling frequency repetition. fS > 2 B no aliasing. -B 0 B fS/2 f Discrete spectrum (c) Aliasing & corruption (c) fS 2 B aliasing ! Aliasing: signal ambiguity 0 fS/2 f in frequency domain Slides adapted from ME Angoletta, CERN 1 AntialiasingAntialiasing filter filter (a) Signal of interest (a),(b) Out-of-band noise can alias Out of band Out of band noise into band of interest. Filter it before! noise (c) Antialiasing filter -B 0 B f Antialiasing filter (b) Passband: depends on bandwidth of interest. Attenuation AMIN : depends on -B 0 B fS/2 • ADC resolution ( number of bits N). (c) f AMIN, dB ~ 6.02 N + 1.76 Antialiasing • Out-of-band noise magnitude. Passband filter frequency Other parameters: ripple, stopband frequency... -B 0 B f Slides adapted from ME Angoletta, CERN 2 ADCADC -- Number Number ofof bitsbits NN Continuous input signal digitized into 2N levels. 1113 Uniform, bipolar transfer function (N=3) 2 V 1 Quantization step q = FSR N 0 2 -4-3-2-101234 -1 V Ex: VFSR = 1V , N = 12 q = 244.1 µV 010 -2 001 -3 Voltage ( = q) 000 -4 LSB N VFSR LSB Scale factor (= 1 / 2 ) 1 q / 2 Percentage (= 100 / 2N ) 0.5 0 -4 -3 -2 -1 0 1 2 3 4 -0.5 - q / 2 Quantisation error -1 Slides adapted from ME Angoletta, CERN 2 ADCADC -- Quantisation Quantisation errorerror 0.3 0.2 • Quantisation Error eq in 0.1 [-0.5 q, +0.5 q]. 0 • eq limits ability to resolve Voltage [V] 0246810 small signal. -0.1 -0.2 • Higher resolution means time [ms] lower eq. Slides adapted from ME Angoletta, CERN FrequencyFrequency analysis:analysis: why?why? • Fast & efficient insight on signal’s building blocks. • Simplifies original problem - ex.: solving Part. Diff. Eqns. (PDE). • Powerful & complementary to time domain analysis techniques. • The brain does it? General Transform as problem-solving tool analysis time, t frequency, f F s(t), S(f) : s(t) S(f) = [s(t)] F Transform Pair synthesis Slides adapted from ME Angoletta, CERN FourierFourier analysisanalysis -- tools tools Input Time Signal Frequency spectrum 2.5 2 1.5 1 T 0.5 1 0 −jk ω t 012345678 Periodic ck = ⋅ s(t)⋅e dt time, t FS Discrete T ∫ (period T) 0 2.5 Continuous j2π f t 2 +∞ − 1.5 Aperiodic Continuous S(f) = s(t)⋅e dt 1 FT ∫−∞ 0.5 0 024681012 time, t 2.5 N−1 2πk n 2 ~ 1 −j 1.5 c = s[n]⋅e N 1 k Periodic ** Discrete N ∑ 0.5 DFS n=0 0 012345678 (period T) time, tk +∞ Discrete S(f) = ∑s[n]⋅e−j2π f n 2.5 DTFT Continuous 2 n=−∞ 1.5 Aperiodic 1 2πk n 0.5 1 N−1 −j 0 ~ N 024681012time, t DFT** ck = s[n]⋅e k DFT Discrete N ∑ n=0 Note: j =√-1, ω = 2π/T, s[n]=s(tn), N = No. of samples ** Calculated via FFT Slides adapted from ME Angoletta, CERN AA littlelittle historyhistory ¾ Astronomic predictions by Babylonians/Egyptians likely via trigonometric sums. ¾ 1669: Newton stumbles upon light spectra (specter = ghost) but fails to recognise “frequency” concept (corpuscular theory of light, & no waves). ¾ 18th century: two outstanding problems → celestial bodies orbits: Lagrange, Euler & Clairaut approximate observation data with linear combination of periodic functions; Clairaut,1754(!) first DFT formula. → vibrating strings: Euler describes vibrating string motion by sinusoids (wave equation). ¾ 1807: Fourier presents his work on heat conduction ⇒ Fourier analysis born. → Diffusion equation ⇔ series (infinite) of sines & cosines. Strong criticism by peers blocks publication. Work published, 1822 (“Theorie Analytique de la chaleur”). Slides adapted from ME Angoletta, CERN AA littlelittle historyhistory -2-2 ¾ 19th / 20th century: two paths for Fourier analysis - Continuous & Discrete. CONTINUOUS → Fourier extends the analysis to arbitrary function (Fourier Transform). → Dirichlet, Poisson, Riemann, Lebesgue address FS convergence. → Other FT variants born from varied needs (ex.: Short Time FT - speech analysis). DISCRETE: Fast calculation methods (FFT) → 1805 - Gauss, first usage of FFT (manuscript in Latin went unnoticed!!! Published 1866). → 1965 - IBM’s Cooley & Tukey “rediscover” FFT algorithm (“An algorithm for the machine calculation of complex Fourier series”). → Other DFT variants for different applications (ex.: Warped DFT - filter design & signal compression). → FFT algorithm refined & modified for most computer platforms. Slides adapted from ME Angoletta, CERN FourierFourier SeriesSeries (FS)(FS) A periodic function s(t) satisfying Dirichlet’’s conditions * can be expressed as a Fourier series, with harmonically related sine/cosine terms. sis a , a , b : Fourier coefficients. es +∞ 0 k k th yn s(t) = a0 + []ak ⋅cos(k ω t) −bk ⋅sin(k ω t) : harmonic number, sy ∑ k k=1 For all t but discontinuities T: period, ω = 2π/T s si ys al na T an 1 (signal average over a period, i.e. DC term & a0 = ⋅ s(t)dt T ∫ zero-frequency component.) 0 T 2 ak = ⋅ s(t)⋅cos(k ω t)dt T ∫ Note: {cos(kωt), sin(kωt) } 0 k form orthogonal base of T 2 function space. -bk = ⋅ s(t)⋅sin(k ω t)dt T ∫ 0 * see next slide Slides adapted from ME Angoletta, CERN FSFS convergenceconvergence Dirichlet conditions (a) s(t) piecewise-continuous; (b) s(t) piecewise-monotonic; In any period: T (c) s(t) absolutely integrable , ∫ s(t) dt < ∞ 0 T Rate of convergence Example: if s(t) discontinuous then square wave |ak|<M/k for large k (M>0) s(t) T (a) (b) (c) Slides adapted from ME Angoletta, CERN FSFS analysisanalysis -- 1 1 1.5 FS of odd* function: square wave. 2 π 1 T = 2π ⇒ ω = 1 0.5 ⎧π 2π ⎫ 1 ⎪ ⎪ 0 a0 = ⋅⎨ ∫∫dt + (−1)dt⎬ = 0 (zero average) 2π ⎪ ⎪ 0246810t ⎩0 π ⎭ -0.5 ⎧π 2π ⎫ 1 -1 ⎪ ⎪ square signal, sw(t) ak = ⋅⎨ coskt dt − coskt dt⎬ = 0 π ∫∫ (odd function) ⎩⎪0 π ⎭⎪ -1.5 ⎧π 2π ⎫ 1 ⎪ ⎪ 2 -bk = ⋅⎨ ∫∫sinkt dt − sinkt dt⎬ = ... = ⋅{}1− coskπ = * Even & Odd functions π ⎪ ⎪ k ⋅π ⎩0 π ⎭ s(x) ⎧ 4 Even : , k odd ⎪ k ⋅π ⎪ s(-x) = s(x) = ⎨ x ⎪ 0 , k even ⎪ ⎩ s(x) 4 4 4 Odd : sw(t) = ⋅sin t + ⋅sin 3⋅t + ⋅sin 5⋅t +..