4. Multirate Systems and their Applications Inefficient Implementation of Downsampling x[n ] H z y[m] N We compute here … and throw away most of them here!!!! N Inefficient Implementation of Upsampling x[n ] N H z y[m] Most terms here are zero … and waste time to process them here!!!! N H z $$ $$ y[m] Recall the Noble Identities x[n ] H z N y[m] N x[n ] N H z y[m] Same!!! x[n ] N H zN y[m] x[n ] H z y[m] N Example… h[n ] h[n] 0 for n odd H ( z ) h[n] h[0] h[2]z 2 h[4]z 4 ... H ( z 2 ) n x[n ] H z 2 2 y[m] H z 2 2.0 1.5 z 2 1.5 z 4 1.2 z 6 x[n ] 2 H z y[m] H z 2.0 1.5z 1 1.5 z 2 1.2 z 3 … continued x[n ] H z2 2 y[m] h[n ] h[m ] m n x[n ] 2 H z y[m] Example… Same h[n ] x[n ] 2 y[m] H z2 H z 2 2.0 1.5 z 2 1.5 z 4 1.2 z 6 x[n ] H z 2 H z 2.0 1.5z 1 1.5 z 2 1.2 z 3 y[m] … continued x[n ] y[m] H z2 2 h[m ] h[n ] m n x[n ] H z 2 y[m] General Filter: Polyphase Decomposition In general: Polyphase Decomposition. Take N=2: 2 4 H z h[0] h[2]z h[4]z ... 1 2 5 z h[1] h[3]z h[5]z ... H z H 0 z z H1 z 2 with 1 2 H 0 ( z 2 ) h[2m]z 2 m m H1 ( z 2 ) h[2m 1]z 2 m m Polyphase Components Downsampling using Polyphase Decomposition x[n ] H z y[m] 2 2 x[n ] H1 z z 1 2 H 0 z y[m] POLYPHASE NOBLE IDENTITY H1 z 2 x[n ] z 1 H0 z2 y[m] 2 Serial to Parallel (Buffer) x[n ] 2 x1[m] x[2m 1] 2 x0 [m] x[2m] z 1 This is a Serial to Parallel (a Buffer): x[n ] S/P x1[m] 0 1 3 5 x0 [m] 0 2 0001234567 2 n0 m0 4 6 Upsampling using Polyphase Decomposition x[n ] 2 H z y[m] NOBLE IDENTITY H 0 z x[n ] H1 z POLYPHASE x[n ] 2 H0 z2 H1 z 2 y[m] z 1 y[m] 2 z 1 2 NOBLE IDENTITY Parallel to Serial (Unbuffer or Interlacer) y0 [n] y[ m ] 2 z 1 y1[n] 2 This is a Parallel to Serial (an Unbuffer): 5 y0 [ n ] 0 2 4 6 y1[n] 0 1 n0 3 P/S 2 y[ m ] 0001234567 m0 General Polyphase Decomposition Given any integer N: H z n h [ n ] z n Nk z h[kN ]z k 0 N 1 Hk zN H ( z ) H 0 z N z 1 H1 z N ... z ( N 1) H N 1 z N Example: take N=3 H ( z ) 2.1 .5z 1 .3z 2 4.2 z 3 0.6 z 4 1.4 z 5 0.2 z 6 0.7 z 7 H 0 ( z 3 ) 2.1 4.2 z 3 0.2 z 6 H1 ( z 3 ) .5 0.6 z 3 0.7 z 6 H 2 ( z 3 ) .3 1.4 z 3 Apply to Downsampling… H z x[n ] y[m] N POLYPHASE H N 1 z N z 1 H2 zN z 1 H1 z N x[n ] z 1 H0 z N y[m] N … apply Noble Identity N H N 1 z N H2 z N H1 z z 1 z 1 x[n ] z 1 N H0 z y[m] Serial to Parallel (Buffer) N z 1 N x1[m] x[mN 1] N x0 [m] x[mN ] z 1 x[n ] xN 1[m] x[(m 1) N 1] Serial to Parallel (Buffer): x[n ] 1 2 3 4 5 S/P 6 N n N n0 xN 1[m] 1 3 5 2 4 6 x0 [m] m0 Same for Upsampling… N x[n ] H z y[m] POLYPHASE x[n ] N H0 z N y[m] z 1 H1 z N H N 1 z N z 1 … apply Noble Identity x[n ] H z N y[m] NOBLE IDENTITY x[n ] H 0 z H1 z z 1 N H N 1 z y[m] N z 1 N Parallel to Serial (Unbuffer or Interlacer) N y0 [n] N y N 1[n ] y[ m ] z 1 This is a Parallel to Serial (an Unbuffer): 1 3 5 2 4 6 y0 [ n ] y N 1[n ] n0 n 1 y[ m ] P/S N 1 m0 2 3 mN 4 5 6 Processing Data by Blocks • In most efficient implementations we process data by blocks, rather than one sample at a time. • Real Time simulation and design software such as Simulink are designed to take advantages of block processing for two purposes: • efficient computations, thus faster simulations; • efficient design. “Sample Based” and “Frame Based” Signals N Sample Based: [M N ] M time They are MN distinct signals arranged in a matrix Particular Case: [ M 1] x[n ] x1[n] is like M distinct signals xM [n] “Sample Based” and “Frame Based” Signals M Frame Based: x1[n] [M N ] xN [ n] They are N distinct signals, each one represented as a sequence of frames of length M Particular Case: [ M 1] x[n ] one signal as a sequence of M frames of length M Convert “to Sample” and “to Frame” Example: 5 y0= y1= y2=y0= 5 Frame based Sample based Frame based Serial to Parallel in Simulink Serial to Parallel is implemented by the “Buffer” Simulink block in Signal Processing Blcokset > Signal Management > Buffers: x[n ] S/P N xN 1[m] x0 [m] [ N 1] [11] Sample based Frame based Buffer Example of Downsampling DF FIR x1[m] [2x1] [2x1] 1 x[n] H1(z) 1 x0[m] Add Buffer y[m] DF FIR H0(z) x1[m ] 2 H1 z 2 H 0 z z 1 x[n] x0 [ m ] y[m] Parallel to Serial in Simulink Parallel to Serial is implemented by the “UnBuffer” Simulink block in Signal Processing Blcokset > Signal Management > Buffers: y0 [ n ] y N 1[n ] y[ m ] P/S N [ N 1] [11] Frame based Sample based Unbuffer Example of Upsampling DF FIR y0[n] 1 x[n] H0(z) 2 2 DF FIR y1[n] To Frame [2x1] [2x1] 1 y[m] Frame Conversion Unbuffer H1(z) x[n] H 0 z y0 [ n ] y[m] 2 z 1 H1 z y1[n ] 2