2. Multirate Signals Content • Sampling of a continuous time signal • Downsampling of a discrete time signal • Upsampling (interpolation) of a discrete time signal Sampling: Continuous Time to Discrete Time Time Domain: x[n] x(nTs ) x(t ) n t Fs Frequency Domain: X DTFT ( f ) X FT (F ) F Fs Fs / 2 1 2 X DTFT ( f ) Fs X F kF k FT s F f Fs Fs / 2 1 2 Fs F f F Fs Reason: x[n] (t nT ) x(t ) s n (t nT ) s n FT x(t ) (t nTs ) X FT ( F ) * Fs ( F nFs ) Fs X FT ( F nFs ) n n n same FT x[n] (t nTs ) n same x[n]e n j 2n F Fs F X DTFT Fs Antialiasing Filter x(t ) Anti-aliasing Filter X FT (F ) x[n] x(nTs ) H (F ) Fs H (F ) noise B Fs 2 sampled noise Fs Fs F FPASS B Fs 2 B Fs FSTOP Fs B 2 For large SNR, the noise can be aliased, … but we need to keep it away from the signal Fs F Fs B Example x[n] x(nTs ) H (F ) x(t ) Anti-aliasing Filter 1. Signal with Bandwidth 2. Sampling Frequency B 3 kHz Fs 11kHz 3. Attenuation in the Stopband H (F ) dB 0 Fs A 60 dB B Fs B 3 8 F (logscale) Filter Order: 60 slope 60 20N log10 83 N 7 Downsampling: Discrete Time to Discrete Time y[m] x[m N] x[n] N 1 2 3 2 1 6 3 4 5 0 y[m] x[m N] 7 2 n 1 0 Keep only one every N samples: 1 2 3 2 1 6 3 0 N 3 4 5 7 n 1 m Effect of Downsampling on the Sampling Frequency y[m] x[m N] x[n] N y[m] x[m N] Fs 2 Fs1 / N Ts1 3 2 1 6 3 0 Ts1 4 5 7 t 0 Ts 2 t Ts 2 N Ts1 The effect is resampling the signal at a lower sampling rate. Effect of Downsampling on the Frequency Spectrum y[m] x[m N] x[n] N X( f ) Fs 2 Fs1 / N Fs1 Fs1 1 0 Fs1 1 Y( f ) ? F f We can look at this as a continuous time signal sampled at two different sampling frequencies: X( f ) Fs1 x[n] s(nTs1 ) s (t ) S (F ) Fs1 1 Fs1 1 F f Fs1 0 1 Y( f ) F y[m] s(mTs 2 ) 0 Fs 2 Fs 2 Fs1 Fs 2 1 0 Fs 2 1 Fs1 F f Effect of Downsampling on DTFT Y(f) can be represented as the following sum (take N=3 for example): F Y( f ) Y F s2 1 F X 3 Fs1 Fs 2 Fs1 Fs 2 1 0 Fs 2 1 0 Fs 2 1 1 F f Fs 2 Fs1 1 F f 1 F 2 Fs 2 X 3 Fs1 Fs 2 Fs1 Fs1 1 F Fs 2 X 3 Fs1 Fs 2 Fs1 Fs 2 0 Fs 2 1 Fs1 F f Effect of Downsampling on DTFT F 1 N 1 F kFs 2 Y X F N F k 0 s1 s2 Since Fs 2 Fs1 / N we obtain: 1 N 1 f k Y f X N k 0 N N X( f ) x[n] y[m] x[m N] N Fs 2 Fs1 / N Downsampling with no Aliasing y[m] x[m N] x[n] N Fs 2 Fs1 / N Fs1 If bandwidth b Xf then Y ( f ) 1 2N 1 N X f N B B Nb Fs 2 Fs1 / N Y f 1 1 N 1 2N 1 2N 12 b 1 2 f Nb 12 Stretch! b B Fs1 1 2 f Antialiasing Filter In order to avoid aliasing we need to filter before sampling: f PASS B / Fs1 b 1 f STOP Fs 2 B / Fs1 2N LPF X( f ) b 1 N y[m] LPF noise x[n] b 1 2N N Fs1 Fs 2 Fs1 / N f b Nb 1 2N f1 aliased 1 2 f2 Example y[m] LPF 4 x[n] Fs1 Fs 2 Fs1 / 4 Let x[n] be a signal with bandwidth B 2kHz sampled at Fs 44kHz Then Passband: f PASS B 2 1 Fs1 44 22 Stopband: f STOP Fs 2 B 1 1 9 Fs1 4 22 44 f PASS b LPF f STOP f 1 N b See the Filter: Freq. Response… h=firpm(20,[0,1/22, 9/44, 1/2]*2, [1,1,0,0]); passband stopband Magnitude (dB) 50 0 -50 -100 -150 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9 1 Phase (degrees) 0 -200 -400 -600 -800 2f … and Impulse Response h[n] 0.3 0.25 0.2 0.15 0.1 0.05 0 -0.05 0 5 10 15 20 25 Upsampling: Discrete Time to Discrete Time x[n] y[m] N Fs1 x[n] 1 0 x[k ] [m kN ] k Fs 2 NFs1 N n 0 m it is like inserting N-1 zeros between samples Effect of Upsampling on the DTFT x[n] y[m] N Fs 2 NFs1 Fs1 “ghost” freq. X( f ) Y ( f ) X ( Nf ) Y( f ) “ghost” freq. 1 2 b 12 1 2 f 1 2 1 N N b 1 2 N N N 1 2 it “squeezes” the DTFT Reason: Y( f ) y[m]e m j 2fm j 2fnN x [ n ] e X ( Nf ) n f Interpolation by Upsampling and LPF f STOP 1Nb LPF f2 X( f ) x[n] N Fs1 1 2 b 1 2 LPF Fs 2 NFs1 f PASS b N Y( f ) y[m] f 1 2 1 2 1 N b N 1 N 1 2 f b N 1 2 SUMMARY: f PASS b B / Fs1 f STOP N1 b Fs 2 B / Fs1 LPF X( f ) Y( f ) y[m] x[n] b LPF N Fs1 Nb f 1 2N f STOP 1Nb Fs1 B / Fs 2 LPF f2 X( f ) f PASS x[n] N Fs1 1 2 b 1 2 f f 1 2 b N B / Fs 2 Y( f ) LPF y[m] 1 2 b N 1 2 f