1

Notes 26 largely plagiarized by %khc With the exception of the ®rst section, this material is optional. It will be a preview for those of you who wish to take ee123.

1 FIR

j!T

s

H e Suppose someone gives you an  and tells you to design an FIR ®lter with that frequency response. What do you do? Well, ®rst you have to ®gure out what an FIR ®lter is. FIR stands for ª®nite impulse response,º in the sense that the impulse response of the ®lter is of ®nite duration, ie:

k1

X

h[n]= b  [n k ]

k

=k k 0

What does that imply about the LDE for the ®lter?

[n] H z  If h is given as above, is then:

k1

X

k

H z  = b z

k

=k

k 0

Y z 

z =

The difference equation is then obtained by setting H , cross-multiplying, and then inverse Z transforming:

X z 

k1

X

y [n] = b x[n k ]

k

=k

k 0

z  What else does the transfer function tell us? Appropriately massaging H by clearing the negative exponents of

z gives:

k1

X

k

H z  = b z

k

=k k 0

k1

1 X

k

k1

= b z k

k1

z

=k k 0

Note that all the poles of the system are at the origin, which tells you that the system is always stable, and that the

zeros determine what the frequency response of the system looks like and the overall behavior of the system.

j!T

s

 e h[n]

Anyway, how does that relate back to our original question? We have H ; how do we get ? If we know

j!T

s

 e that H is the DTFT, then we just use the inverse DTFT. Because the DTFT is just a , we can apply the same tricks that we used for the Fourier series to get the inverse DTFT, namely multiplying by the complex

conjugate of the complex exponential and then integrating over a single period:

1

X

j!T jn!T

s s

H e  = h[n]e

n=1

1

X

j nm!T j!T jm!T

s s s

 = h[n]e H e e

n=1

Z  Z 

1

X

T T

s s

jm!T j nm!T j!T

s s s

e h[n]e H e d! d! =

 

T T n=1

s s EE120: and Systems; v5.0.0 2

There is nothing much that can be done with the left side of the equation, but on the right side we can interchange the

summation and integration

 

Z Z

1

X

T T

s s

j!T jm!T j nm!T

s s s

d! = h[n] H e d! e e

 

T T n=1

s s Note that the integral on the right hand side is just the orthogonality condition [the same one that we used for Fourier

series], namely:



Z 

2 

T

s

= m

if n

j nm!T

s

T

s

e d! =

 6= m

0ifn

T

s

= m

So all the terms in the summation go away, except for the one where n :



Z

T s

2 

jm!T j!T

s s

h[m] e H e d! =



T

s

T

s n

This last equation, if we replace the dummy variable m by gives us the inverse DTFT:



Z

T

s

T

s

jn!T j!T

s s

d! e H e h[m] =





2

T s

Exercise Compare the above derivation to that of the Fourier series. Notice the duality.

n 1 1 The main problem is what to do about the values for n.Dowelet range from to ? Well, if we're trying

to make an FIR system, we should make the impulse response of ®nite duration. So we just take some range of n,

[n] h[n]

calculate h for that range, and then set equal to zero outside that range. This truncation unfortunately is the

j!T

s

H e same as multiplying for a box in time, which introduces ripples in the actual . If we take a suf®ciently large

range for n though, the amplitude of the rippling should be acceptable. Exercise Read the last paragraph and make sure that makes sense to you.

2 Use of the DFT T

There are a few things to keep in mind about the DFT; if s is the sampling period [the spacing between points in the

T T = NT

time domain], and 0 is the duration [an integer multiple of the sampling period, or 0 s ]:

f T j

2 s

 X [k ] X e N

 the DFT is just the DTFT sampled uniformly at points on the unit circle:

j f T

2 s

X [k ]= X e j k

f =

T0

 x[n] T = NT

the DFT can also be evaluated by taking and making it periodic with period 0 s ; in the frequency domain, we take the DTFT and multiply it by an impulse train with spacing 1 ; referring back to the setup in T0

notes25:

0

X [k ]= T X f j k =

0 f

T0 T

 the spacing between the frequency samples is a function of the duration 0.

k N k =

 ranging the frequency index from 0 to 1 gives a nonrepeating set of samples of the DTFT, with 0 = corresponding to f 0,

1

= f = k 1 corresponding to , ...,

T0

N 1

= N f = and k 1 corresponding to . T0

 remember from the Nyquist sampling theorem that the actual highest frequency that you can get corresponds to

N 1

= f =

k ,or . T

2 2 s

Exercise Go through the points above. Make sure that you understand them.

k = N T T

Exercise To what frequency does correspond? In terms of 0?Intermsof s ? EE120: Signals and Systems; v5.0.0 3

3 Zero Padding

x[n] X [k ] N x[n]

Suppose we take N samples of , and then ®nd the DFT . This gives us samples of the DTFT of .If

[n] M N + M

we zero pad x by extending it with an additional samples which are zeros, what does the resulting point

0

[k ]

DFT X look like?

+M

N 1

X

nk=N +M  j

0 2

X [k ] = x[n]e =

n 0

N 1

X

j N +M 

2 nk=

= x[n]e =

n 0

N 1

X

j f nT

2 s

x[n]e = j k

f =

T N +M 

s =

n 0

f T j

2 s

j k = X e

f =

T N +M 

s

k k

= N + M M = f =

with k ranging from 0 to 1. If 0, the DTFT gets sampled at , which we had before. If

NT T

s 0

N + M

M>0, the DTFT gets sampled at points instead, so this is one way to increase the resolution in frequency. M

Another way to look at this is to notice that all you did was increase T0 by another samples. So the period of

[n] N + M N + M x is now , and the sampling of the DTFT is now done over points.

4 [Zero Insertion]

M

Upsampling a sequence by a factor of M means to insert 1 zeros in between the the samples of the original

n n

x [n] x [n]= x[ ] M

sequence, giving a new sequence M with if is an integer. What are we doing to the spectrum

M M

when we do that?

[n]

Let's be a bit more concrete about things and say that we upsample by a factor of 4. x4 is then:



n

x[ n

4 ] if is a multiple of 4

[n]=

x4 0otherwise

z 

The Z transform X4 is then:

1

X

n

x z  = [n]z

X4 4

n=1

1

X

n

n

= [ ]z

x 4

=1;multiplesof

n 4

1

X

n

4 m

= x[ z

4 ]

m=1

1

X

n m

4

]z  = [

x 4

m=1

4

= X z 

0

n f T

j 2

s

= X z  z = e x [n]

where the substitution m 4 was made. Evaluating 4 on the unit circle gives the DTFT of 4 :

0 0

j f T f T

j 2 2 4

s s

= X e  e

X4

0

T T

From where did the come? If the original spacing between samples is s and if we maintain the original spacing

s

T

0

s = between the nonzero samples, then the new spacing T . Substituting this into the above gives:

s 4

0

j f T f T j

2 2 s

s

=X e e  X4 EE120: Signals and Systems; v5.0.0 4

Well, the DTFTs are the same. We didn't do anything. How useless.

[n] Or is it? We changed the sampling rate associated with x4 . So the maximum frequency that we can now see if

1 0

x [n] x[n] f = = frac T 0 is four times greater than the one we could see in ,ie max 2 .

4 s

2 T

s

j Ω

[n] X e 

In terms of normalized frequency, if the DTFT of the original sequence x is , then the DTFT of the new

[n]

upsampled sequence x4 is:

1

X

jn j Ω Ω

e  = x [n]e

X4 4

n=1

1

X

n

jnΩ

x[ ]e

= 4

n=1

1

X

mΩ j

4

= x[m]e

m=1

j mΩ

4

= X e 

That extra factor of 4 in the exponent tells us that when we make Ω go around once on the unit circle from 0 to 2 ,it traces through the original spectrum four times. So if the original spectrum looks as it does in Figure 1, the upsampled spectrum is the original spectrum compressed by a factor of 4, as in the same ®gure.

j Ω j Ω X X(e ) 4 (e ) ...... Ω Ω −2π 2π −2π 2π

Figure 1: Original and upsampled spectrum.

Why would one choose to upsample? Read the last few paragraphs of the next section.

5 D/A

We can be even more sloppier with our analog LPF if we ®rst upsample and then do a digital LPF operation ®rst,

before the D/A conversion. Let's pretend that we have a DT sequence with a DTFT being a bunch of triangles repeated 

at intervals 2 , and that the width of each triangle is 4 . In unnormalized frequency, this corresponds to triangles with 

width  , periodic with period 2 .

T T s 4 s

If we upsample by a factor of 4, we end up with the spectrum as in Figure 1. That is, within a period of 2 ,we 

end up with four triangles, each with width 16 . Before converting back to unnormalized frequency, we note that the

T

s T spacing between samples has changed from s to 4 , since we added zeros between the samples. If we look at the CT representation of this DT , it looks like the CT representation of the original DT signal without the zeros inserted.

So it stands to reason that the unnormalized DTFT looks the same as the original unnormalized DTFT. In fact, if we

T 

divide the normalized width by the new sampling period s , we end up with , the width of the unnormalized DTFT T

4 4 s above.

Exercise Verify this. 

3 

;; Ω = If we do a digital LPF and get rid of the triangles at 2 and 2 , we end up with compressed triangles

[compressed by a factor of 4] at intervals 2 , in normalized frequency. This performs an interpolation in the time domain.

8  =

In unnormalized frequency, we leave the triangles at multiples of ! . The thing to notice is that the entire T horizontal axis gets expanded by a factor of four. That gives us a lot mores room to throw in a lousier analog reconstruction ®lter with a wide transition region between passband and stopband, and get away with it. EE120: Signals and Systems; v5.0.0 5

This scheme is commonly used in CD players to lower the cost of the analog reconstruction ®lter. Through a triumph of marketing though, you end up paying for it. 16x oversampling = 16x lousier LPF. There is one thing thoughÐ audio requires you to have an LPF with a response, so that your audio

doesn't sound horrible. With 16x oversampling, you end up making 16 copies of your spectrum between 0 and 2 , and then you kill 15 copies, giving you 15(44.1) kHz, or 661.5 kHz, over which you can put the transition band of the LPF. If we use a cheap single pole RC ®lter with cutoff frequency at 200 kHz, our phase response from 0 to 20 kHz will be largely zero degrees. The process of upsampling, followed by digital low pass ®ltering, is called interpolation.

6 Oversampling A/D

The opposite of upsampling and interpolation can be used to make sampling easier to perform. What we can do is use a not so awesome LPF to act as an anti- ®lter, but sample at a rate signi®cantly above Nyquist.

Let's use 4x oversampling. We begin by assuming that we are only interested in the portion of our CT signal up to !

a maximum frequency of max . We then pass our CT signal through an antialising ®lter that has a frequency response

! ! max which is ¯at up to max and then gradually transitions to zero at 7 . So the frequencies in which we are interested

are not distorted by the LPF.

! ! max

We then sample at a rate of 8 max radians/s. This copies our spectrum at multiples of 8 . In normalized

! 

frequency, 8 max corresponds to our normalized 2 .

! ! max

We then perform a digital LPF to get rid of everything between max and 7 in unnormalized frequency, since

 ! we only care about the frequency content between 0 and max . In normalized frequency, this is from 0 to 4 . We follow this with a downsampling process. All this means in the time domain is that we throw away samples. In our case, since we oversampled by a factor of 4, we keep every fourth sample and throw the others away. What

this does in the frequency domain is stretch our spectrum by a factor of 4, so that it covers the range from 0 to  in normalized frequency. In frequency, we have the equivalent of the DTFT corresponding to the sequence that was sampled at the . However, we got away with using a much less expensive anti-aliasing ®lter. The process of digital low pass ®ltering, followed by a downsampling operation, is called decimation.