Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

EE123

Digital Signal Processing

Lecture 17
Lab III
Polyphase Filters
M. Lustig, EECS UC Berkeley
Topics

• Last time
– Changing Sampling Rate via DSP
– Upsampling
– Rational resampling
• Today
– Lab III
– Interchanging Compressors/Expanders and
filtering
– Polyphase decomposition
– Multi-rate processing

M. Lustig, EECS UC Berkeley


Lab III - Time-Frequency

• compute spectrograms with w/o windowing

M. Lustig, EECS UC Berkeley


Lab III - Time-Frequency

• Compute with overlapping window

M. Lustig, EECS UC Berkeley


Lab III - Time-Frequency
• Look at temporal/frequency resolution tradeoffs:

M. Lustig, EECS UC Berkeley


FM Broadcast Radio - KPFA 94.1MHz

M. Lustig, EECS UC Berkeley


FM Modulation
x(t) = (L + R) + 0.1 · cos(2⇡fp t) + (L R) cos(2⇡(2fp )t) + 0.05 · RBDS(t) cos(2⇡(3fp )t) +subcarriers signals
| {z } | {z } | {z } | {z }
mono pilot stereo digital RBDS

Broadcast FM baseband signal

L-R
pilot (stereo)
L+R signal RBDS Subcarriers
(mono)

19KHz 38KHz 57KHz 67.65KHz 92 KHz

✓ Z t ◆
yc (t) = A cos 2⇡fc t + 2⇡ f x(⌧ )d⌧
0

M. Lustig, EECS UC Berkeley


Look at Spectrum of Broadcast FM

• Capture 1 second, @fs=2.4MHz


plot spectrogram

KPFA 94.1MHz

M. Lustig, EECS UC Berkeley


Filter Downsample

• h = signal.firwin(513,100000.0,nyq=2400000.0/2,window='hanning')
fs = 2.4MHz

fs = 240KHz

M. Lustig, EECS UC Berkeley


FM demodulation

• Limiter removes unwanted amplitude variation

M. Lustig, EECS UC Berkeley


FM demodulation

• Discriminator converts frequency deviations to


amplitude
– Several implementations possible. Here we use
this:
✓ ◆ Rt Rt
d
yb (t) yb⇤ (t) = j2⇡ f · x(t) · e j2⇡ f 0
x(⌧ )d⌧
·e j2⇡ f 0
x(⌧ )d⌧
dt
= j2⇡ f · x(t)
M. Lustig, EECS UC Berkeley
Differentiator
• Use Parks-McClellan algorithm (Remez exchange algorithm)
• Equiripple optimal filter design
• h_diff = signal.remez(31,[0.0,105000.0,120000.0,120000.0],
[1.05/1.2,0],Hz = 240000.0, type='differentiator')

don’t care
don’t care

-120 -105 105 120


KHz

M. Lustig, EECS UC Berkeley


FM Baseband after Demodulation

Broadcast FM baseband signal

L-R
pilot (stereo)
L+R signal RBDS Subcarriers
(mono)

19KHz 38KHz 57KHz 67.65KHz 92 KHz


M. Lustig, EECS UC Berkeley
Mono (Left + Right Channels)

24KHz

M. Lustig, EECS UC Berkeley


Demodulating Subcarriers

http://www.drybonesblog.blogspot.com/ M. Lustig, EECS UC Berkeley


Demodulating Subcarriers

single sided spectrum

double sided spectrum

M. Lustig, EECS UC Berkeley


Demodulating Subcarriers

24KHz

M. Lustig, EECS UC Berkeley


Demodulating Subcarriers

24KHz

M. Lustig, EECS UC Berkeley


Multi-Rate Signal Processing

• What if we want to resample by 1.01T?


– Expand by L=100
– Filter π/101 ($$$$$)
– Downsample by M=101

• Fortunately there are ways around it!


– Called multi-rate
– Uses compressors, expanders and filtering

M. Lustig, EECS UC Berkeley


Interchanging Operations"

↑L ↓M not LTI!
“expander” “compressor”
Note:

x[n] H(z) ↑L y[n] x[n] ↑L H(z) y[n]

H(ej!L )X(ej!L ) H(ej! )X(ej!L )


H(ej! )X(ej! ) X(ej!L )

M. Lustig, EECS UC Berkeley


Interchanging Operations"

↑L ↓M not LTI!
“expander” “compressor”
Note:

x[n] H(z) ↑L y[n] ≠ x[n] ↑L H(z) y[n]

H(ej!L )X(ej!L ) H(ej! )X(ej!L )


H(ej! )X(ej! ) X(ej!L )

≣ x[n] ↑L H(z L ) y[n]


H(ej!L )X(ej!L )
X(ej!L )
M. Lustig, EECS UC Berkeley
Interchanging Filter Expander

• Q: Can we move expander from Left to


Right (with xform)?

↑L H(z) ≣?
1
H(z L ) ↑L

• A: Yes, if H(z) is rational


No, otherwise

M. Lustig, EECS UC Berkeley


Compressor
Claim:

x[n] ↓M H(z) y[n] ≣ x[n] H(z M ) ↓M ỹ[n]

v[n]
Proof:

M. Lustig, EECS UC Berkeley


Compressor
Proof: !
1
M
X1 ⇣ ! 2⇡i

Y (ei! ) = H(ej! ) X e j( M M )
M i=0

1
M
X1 ⇣ ⌘ ⇣ ! 2⇡i

= H ej(! 2⇡i) X e j( M M )
M i=0 | {z }
H(ej! )

1
M
X1 ⇣ ! 2⇡i
⌘ ⇣ ! 2⇡i

jM ( M M ) j( M M )
= H e X e
M i=0

V (ej! ) = H(ej!M )X(ej! ) after compressor

M. Lustig, EECS UC Berkeley


Compressor
Claim:

x[n] ↓M H(z) y[n] ≣ x[n] H(z M ) ↓M ỹ[n]

M
X1 ⇣ ⌘
! v[n]
1 ! 2⇡i
Y (ei! ) = H(ej! ) X ej( M M )
Proof: M i=0

1 X ⇣ j(! 2⇡i) ⌘ ⇣ j( ! ⌘
M 1
2⇡i
= H e X e M M )
M i=0 | {z }
H(ej! )

1 X ⇣ jM ( ! ⌘ ⇣ ⌘
M 1
2⇡i ! 2⇡i
= H e M M ) X e j( M M )
M i=0 after compressor

Q: Move Compressor from right to left?


V (ej! ) = H(ej!M )X(ej! )
A: Only if H(z1/M) is rational!

M. Lustig, EECS UC Berkeley


Interchanging Operations

x[n] H(z) ↑L y[n] ≣ x[n] ↑L H(z L ) y[n]

x[n] ↓M H(z) y[n] ≣ x[n] H(z M ) ↓M y[n]

M. Lustig, EECS UC Berkeley


Polyphase Decomposition

• We can decomposed an impulse


response to: M
X1
h[n] = hk [n k]
k=0
h0 [n]

h[n]
n
= + h1 [n 1]
n
h0 [n] h1 [n]
n n
n
M. Lustig, EECS UC Berkeley
Polyphase Decomposition

• Define:
hk [n] ↓M ek [n]

ek [n] = hk [nM ]
h0 [n]
e0 [n]

n n
h1 [n] e1 [n]

n n
M. Lustig, EECS UC Berkeley
Polyphase Decomposition

ek [n] ↑M hk [n]
recall upsampling scaling
M
Hk (z) = Ek (z )
Also, recall: M
X1
h[n] = hk [n k]
k=0

So, M
X1
H(z) = Ek (z M )z k

k=0

M. Lustig, EECS UC Berkeley


Polyphase Decomposition
M
X1
H(z) = Ek (z M )z k

k=0

x[n] E0 (z M )
1
z
E1 (z M ) + y[n]
1
z ..
1
.
z
M
EM 1 (z )

Why should you care?

M. Lustig, EECS UC Berkeley


Polyphase Implementation of Decimation

x[n] H(z) y[n] ↓M w[n] = y[nM ]

• Problem:
–Compute all y[n] and then throw away --
wasted computation!
• For FIR length N N mults/unit time

–Can interchange Filter with compressor?


• Not in general!

M. Lustig, EECS UC Berkeley


Polyphase Implementation of Decimation

x[n] H(z) y[n] ↓M w[n] = y[nM ]

H(z)

x[n] E0 (z M )
1
z
E1 (z M ) + y[n] ↓M w[n]
1
z ..
1
.
z
M
EM 1 (z )

M. Lustig, EECS UC Berkeley


Polyphase Implementation of Decimation

x[n] H(z) y[n] ↓M w[n] = y[nM ]

Interchange sum with decimation

x[n] E0 (z M ) ↓M
1
z
E1 (z M ) ↓M + w[n]
1
z ..
1
.
z
EM 1 (z
M
) ↓M

now, what can we do?

M. Lustig, EECS UC Berkeley


Polyphase Implementation of Decimation

x[n] H(z) y[n] ↓M w[n] = y[nM ]

Interchange filter with decimation

x[n] ↓M E0 (z)
1
z
↓M E1 (z) + w[n]
1
z ..
1
.
z what about
↓M EM 1 (z)
interpolation?
Computation: (great midterm Q)
Each Filter: N/M *(1/M) mult/unit time
Total: N/M mult/unit time
M. Lustig, EECS UC Berkeley

You might also like