Signals, Instruments, and Systems W5 Introduction to Signal Processing Sampling, Reconstruction, and Filters
Acknowledgments
Recapitulation of Key Concepts from the Last Lecture
Dirac delta function ( t) 0,, x x 0 0 1 0.8 0.6 ( t) dt 1 0.4 0.2 0-2 -1.5-1 -0.5 0 0.5 1 1.5 2
Convolution f g ( t) f ( ) g( t ) d
Examples 1 1 1 0.8 0.6 0.4 0.8 * 0.6 0.4 = 0.8 0.6 0.4 0.2 0.2 0.2-2 -1.5-1 -0.5 0 0.5 1 1.5 2-2 -1.5-1 -0.5 0 0.5 1 1.5 2-2 -1.5-1 -0.5 0 0.5 1 1.5 2
From Fourier Series to Transform f(t) - an aperiodic signal - view it as the limit of a periodic signal as T For a periodic signal, the harmonic components are spaced ω 0 = 2π/T apart As T, ω 0 0, and harmonic components are spaced closer and closer in frequency
A Linear n-dimensional Transform F Time, space, etc. domain F -1 Frequency, spatial frequencies, etc. domain Idea: generalize to any n-dimensional signal so that a frequency representation can be found; we will focus on dimension 1 (and you will see dimension 2 in the next lab)
Fourier Transform i2 f ( ) f ( t) e dt t Fourier Transform i2 f ( t) f ( ) e d t Inverse Fourier Transform Note: typically in EE: ( i booked for current) 2 j i2
Simple Example 1 0.8 0.6 0.4 0.2 0-0.2-0.4-0.6-0.8 1 0.8 0.6 0.4 0.2-1 -0.8-0.6-0.4-0.2 0 0.2 0.4 0.6 0.8 1 Time [s] f ( t) cos(2 at) f -10-8 -6-4 -2 0 2 4 6 8 10 -a a Frequency [Hz] a a ( ) 2
Train of Dirac Deltas
Sampling
Sampling the Signal (t-domain)
Sampling the Signal (f-domain)
Sampling a Band-Limited Signal
Original Signal 1.5 1 0.5 0-0.5-1 -1.5-1 -0.8-0.6-0.4-0.2 0 0.2 0.4 0.6 0.8 1 Time [s] f ( t) sin(2 t) 0.4sin(2 2t) 0.2sin(2 5t)
Too few samples (1Hz) 1.5 1 0.5 0-0.5-1 -1.5-1 -0.8-0.6-0.4-0.2 0 0.2 0.4 0.6 0.8 1 Time [s] Data is lost
Too many samples (100 Hz) 1.5 1 0.5 0-0.5-1 Redundant data -1.5-1 -0.8-0.6-0.4-0.2 0 0.2 0.4 0.6 0.8 1 Time [s] Increase of data size
Minimal Possible Sampling (> 10 Hz) 1.5 1 0.5 0-0.5-1 -1.5-1 -0.8-0.6-0.4-0.2 0 0.2 0.4 0.6 0.8 1 Time [s]
Nyquist Shannon theorem If a function x(t) contains no frequencies higher than B Hz, it is completely determined by giving its coordinates at a series of points spaced 1/(2B) seconds apart. Sampling frequency must be at least two times greater than the maximal signal frequency
Sampling in Practice Sampling frequency two times greater than maximal frequency is the limit If possible, try to use a sampling frequency 10 times greater than the maximal frequency Audio CD, sampling at 44.1 khz Maximal hearable frequency: 20 khz
Sampling in Practice
Signal Reconstruction
Signal reconstruction Whittaker-Shannon Interpolation x( t) n x[ n] sinc t nt T s s x( t) n x[ n] ( t nt s ) sinc t T s Signal has to be band limited (i.e. Fourier transform for frequencies greater than B equal 0) The sampling rate must exceed twice the bandwidth, 2B 1 T s 2B
Aliasing
No Problems in Reconstruction
Reconstruction Problems Overlapping Alias
Harmonics Fundamental Frequency
Harmonics 1 0.5 0-0.5-1 -0.5-0.4-0.3-0.2-0.1 0 0.1 0.2 0.3 0.4 0.5 Time [s] 1Hz 2Hz 3Hz 4Hz
La-Tone (440 Hz) sampled at 44.1 khz (CD standard)
La-Tone (440 Hz) sampled at 4 khz without filtering
La-Tone (440Hz) sampled at 4 khz filtered at 2 khz
Aliasing example Original sound Aliases 4 khz Correct sampling 4 khz
Moiré Pattern
Various Transforms
Laplace transform F ( s) L f(t) e st f ( t) dt 0 s i
Fourier - Laplace F ( ) F{ f ( t)} L{ f ( t)} s i F ( s) s i e i t f ( t) dt Fourier is a special case of Laplace transform Fourier: frequency response (especially in signal processing) Laplace: impulse response (especially in control)
Z transform Corresponds to Laplace transform for timediscrete signals Transform signals from time-domain to frequency domain X ( z) Z{ x[ n]} x[ n] z n n z Ae j or z A(cos j sin )
Different Transforms Fourier Transform F( ) f ( t) e 2 i t dt Laplace Transform F( s) f ( t) e st dt, s i 0 Discrete- Time Fourier Transform X[ ] x[ n] e i n n Z Transform Z{ x[ n]} x[ n] z n, z Ae j Discrete Fourier Transform X[n] N 1 n x[ n] e 2 N i kn, k 0,, N 1 n 0 Fast Fourier Transform (FFT) is an algorithm to compute the Discrete Fourier Transform (DFT)
DAC ADC Transform Overview Continuous signal Time domain Fourier/Laplace Fourier Inverse Continuous signal Frequency domain Discrete signal Time domain Z/DTFT Inverse Z/DTFT Discrete signal Frequency domain
Filtering
Filtering noisy signals day/night cycle Solar radiation changing cloud cover low pass filter high pass filter
Decibel V1 V2 G db 2 1 2 1 20log 10 V V V V G 1( gain) db V V G 1( damping) db 2 1 Source of sound Sound pressure Sound pressure level pascal db re 20 μpa Jet engine at 30 m 630 Pa 150 db Rifle being fired at 1 m 200 Pa 140 db Threshold of pain 100 Pa 130 db Hearing damage (due to short-term exposure) 20 Pa approx. 120 db Jet at 100 m 6 200 Pa 110 140 db Jack hammer at 1 m 2 Pa approx. 100 db Hearing damage (due to long-term exposure) 6 10 1 Pa approx. 85 db Major road at 10 m 2 10 1 6 10 1 Pa 80 90 db Passenger car at 10 m 2 10 2 2 10 1 Pa 60 80 db TV (set at home level) at 1 m 2 10 2 Pa approx. 60 db Normal talking at 1 m 2 10 3 2 10 2 Pa 40 60 db Very calm room 2 10 4 6 10 4 Pa 20 30 db Leaves rustling, calm breathing 6 10 5 Pa 10 db Auditory threshold at 1 khz 2 10 5 Pa 0 db
Bode plot not to scale!
Filter design
Filters Analog Circuit Digital A/D Function y y f ( x x ) 1 n 1 n
Transfer Functions of Filters Analog Circuit Numerator Laplace Transf. Hs () v v c in 1 1 RCs Denominator Digital Function y y f ( x x ) 1 n 1 n z-transf. Numerator H( z) 1 b0 b1z bn z 1 1 a1z bm z N M Denominator
Bode Plot - Rules Zero (numerator = 0) Amplitude: 20 db/decade Phase: 90, 45 /decade, starting 1 decade before zero Pole (denominator = 0) Amplitude: -20 db/decade Phase: -90, -45 /decade, starting 1 decade before pole
Bode plot (magnitude) Zero (numerator = 0) Amplitude: 20 db/decade Pole (denominator = 0) Amplitude: -20 db/decade
Bode plot (phase) Zero (numerator = 0): 90, 45 /decade, starting 1 decade before zero Pole (denominator = 0): -90, -45 /decade, starting 1 decade before pole
Filter Order and Type 1 st order is equivalent to 20dB per decade Each successive order adds 20dB per decade Filter with a high order are closer to the ideal filter (rectangular function) Several filters exists and are defined by the polynomes at the numerator/denominator (Finite Impulse Response, Bessel, Butterworth, Tschebishev, etc.)
Analog Filter Order Filter order: 3 ++ faster cutoff -- more components -- higher power consumption Digital y[ n] a x[ n] 0 y[ n] a x[ n] a x[ n 1] 0 1 y[ n] a x[ n] a x[ n 1] a x[ n 2] 0 1 2 Filter order: 1 Filter order: 2 Filter order: 3 ++ faster cutoff -- more computation -- higher power consumption
Bode plot First order Low Pass Filter
Low Pass Filter - RC circuit
High Pass Filter RC circuit
Bode plot first order high pass filter
Digital Low-Pass Filter
Digital High-Pass Filter
Digital Filter Transfer function: H( z) 2 2 2 1 2 ( z 1) z 2z 1 1 2 z z Y ( z) 1 3 2 1 3 1 1 3 2 X( z) ( z )( z ) z z 1 z z 2 4 4 8 4 8 Difference equation: N y[ n] a y[ n k] b x[ n k] k M k 1 k 0 1 3 y[ n] x[ n] 2 x[ n 1] x[ n 2] y[ n 1] y[ n 2] 4 8 x General case
Conclusion
Take-Home Messages A number of n-dimensional linear transforms allow for moving from the original domain (e.g. time, space to) to the frequency domain and back Time-continuous and time-discrete versions exist A number of operations are easier to carry out and understand in the frequency domain Signals can be sampled and reconstructed properly if fundamental limits are respected Filters allow a number of operations (e.g., noise removal, contrast enhancement, etc.) and are often easier to design in the frequency domain
Additional Reading Books Ronald W. Schafer and James H. McClellan DSP First: A Multimedia Approach, 1998 A. Oppenheim and A. S. Willsky with S. Hamid, Signals and Systems, Prentice Hall, 1996.