30
5-32 In this case, no aliasing occurs and the decimation equation can be expressed as: Since aliasing is very undesirable, the decimator is often preceded by a lowpass filter which insures that aliasing will not occur for 1 M X M Y M h(n ) y (n ) x (n) w(n) where otherwise 0, M , 1 H H M M ideal LPF

In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-32

In this case, no aliasing occurs and the decimation equation can be expressed as:

Since aliasing is very undesirable, the decimator is often preceded by a lowpass filter which insures

that aliasing will not occur

for 1

MXM

Y

Mh(n) y(n)x(n)

w(n)

where

otherwise 0,M

,1

H

H

M

M

ideal LPF

Page 2: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-33

)(CX )(CX

)()( TXX CS

)(X

)(X

)(dX

)(dX

)( TX d

)(dH

)()()(~

XHX d

)(~

dX

Page 3: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-34

Increasing the Sampling Rate by an Integer Factor

When the sampling interval is decreased by an integer factor, L

then the sampling rate is increased by the same factor

Now suppose we have a sequence x(n) which has been obtained by sampling x(t) at t = nT.

And we want a new sequence y(n) which could have been obtained by sampling x(t) at t = nT '. This

implies that we must interpolate L–1 new sample values between each pair of sample values of x(n).

T'T

L

Fs'

1

T 'L

T LFs

nTt

nnxnTxtx

=

<<-for

Page 4: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-35

Therefore, TxTnxnTyLn

integer)an is (i.e., ,20for Ln

Ln LL, , n=xny

and y n 0 otherwise

Lx(n)

y(n) x nL

A finite sequence

L = 2 (i.e., zero-fill between

each sample of x(n))

A new sequence, but the up-

sampler does not give us this. So

where does it come from?

x(n)

Lnxny

)(nw

n

n

n

Page 5: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-36

To answer this question let's examine the interpolation process in the frequency domain.

n

njenyY

n

nj

Ln exY

LXY

L

nxny where

so

r

LrjerxY then

therefore

Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling implies

only a scaling of the frequency axis.

To complete the interpolation process, some mechanism must be included to filter out the unwanted

images so that the output signal sequence truly looks as if it were sampled at a higher rate.

integeran is whereL

nr

Page 6: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-37

The complete system is

L h(n)

y(n)

x(n) w(n)

LPF

otherwise 0,L

,

LH

An illustration of the process follows:

x(n)

)(ny

)(X

)(Y2let L

rateNyquisttheatsampledoriginally)(tx

n

n

6 4 2 2 4 60

T

1

T

1

3 2 2 30

2

Page 7: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-38

Low-pass filter)(H

)(W

)(nw

n

L

'

1

TT

L

22

2 30

2

22

2 30

2

4

Low-pass filtering removes the unwanted images.

Page 8: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-39

An interesting example is linear

interpolation. It is not highly accurate but it

is simple and popular.

)(CX

)(X

)()( LXX e

)(H

)()()(~

eXHX

)(H

)(linH

Page 9: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-40

Changing the Sampling Rate by a Non-Integer Factor

L MLPF

Gain = 1

Cutoff = /M

LPF

Gain = L

Cutoff = /L

ML

L

T

L

T

L

T

L

MTT

LPF

Gain = L

Cutoff =

min{/L, /M}

TL

T

L

T

L

MT

Sampling period

Sampling period

nx

nx

ny

ny

For example, if we want T’ = 1.01T, then let L = 100 and M = 101

These two linear filters can be implemented as one

Page 10: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-41

Here’s an example from the text:

Change the original sampling rate by a non-integer

factor:

32 nx ny nh

H

3

3

2

)(CX

)(X

)(eX

)(dH

)()()(~

ed XHX

)(~

dX

Page 11: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-42

5.6 Multirate Signal Processing

From a practical point of view, implementing large decimation and interpolation factors is not

efficient since high order filters are often needed.

Multirate techniques focus on the upsampler/downsampler to increase the efficiency of DSP systems.

Interchanging of Filtering and Downsampling/Upsampling

To implement a fractional change in the sampling rate it follows that a cascade of an upsampler and a

downsampler should be used. We would like to determine under what conditions a cascade of a factor

of M downsampler and a factor of L upsampler can be interchanged. That is:

nx nyM L nx nyML

It can be shown that this interchange is possible only if M and L are relatively prime. That is, M

and L do not have a common factor that is an integer k > 1.

Page 12: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-43

XMHXb

M

k

bM

k

MX

MY

0

21

kHM

k

MX

MY

M

k

221

0

nx

nx

ny

ny

nxa

nxb

M

M

zH

MzH

A related case is presented with decimation shown below. In one case a filter follows the down-sampler

(operating at a lower sampling rate) and in the other case a filter precedes the down-sampler (operating at

a higher sampling rate). Both systems are equivalent, as shown in the equations below:

a

M

k

XHM

k

MX

MHY

0

21

M

k

aM

k

MX

MX

0

21

(i)

(ii)

using (ii)

this is just Xa() from (i)

aXHY

Page 13: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-44

A similar principle applies to interpolation:

nx

nx

ny

ny

nxa

nxb

L zH

LzHL

LHLXLXY a

LXXb

LXLHXLHY b

( ) ( )aX X H

Page 14: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-45

Polyphase Decomposition

Representing a sequence (or impulse response) as M subsequences, each consisting of every M th value

of successively delayed versions of the sequence.

This approach can lead to efficient implementation of filters

otherwise

of multipleinteger

0

Mnknhnhk

1

0

M

k

k

h n h n k

nMhknMhne kk

These are the “polyphase components” of h(n)

Note: Decomposition, not filtering operation!

Page 15: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-46

Example of a polyphase decomposition with

M = 3An equivalent representation is shown below.

Note these are not filter realizations, but rather,

they show how a filter can be decomposed into

parallel filters.

)(0 ne

)(1 ne

)(2 ne

n

n

nn

)(nh

Page 16: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-47

Polyphase Implementation of Decimation Filters

nx

)(nwnMy w n

M zH

1

0

M

k

kM

k zzEzH

filter-then-decimate

decimate-then-filter

nMhknMhne kk

Page 17: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-48

Polyphase Implementation of Interpolation Filters

nx

( )n

w x nL

y nL zH

filter-then-interpolate

interpolate-then-filter

Page 18: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-49

5.7 Digital Processing of Analog Signals

All previous signal conversions were ideal as described in the diagram below:

However, practical considerations reveal the following sources of error:

• continuous-time signals are not bandlimited

• ideal filters cannot be realized

• ideal C/D and D/C converters cannot be realized

The way in which signals are converted in actuality is shown below

Page 19: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-50

A/D and D/A converters have non-ideal behavior that impacts the entire system.

Of course, the general approach is to minimize the sampling rate. Why?

Note that even for ideal C/D converters an anti-aliasing filter is needed in order to band-limit the input signal.

jHaa

cc

T

T

TTH

Heff

,0

,Note that:

caaeff HHH ,

But with the anti-aliasing filter, this becomes

With this approach, sharp cutoff anti-aliasing LPF is required.

We would like to avoid the cost of such filters by using DSP

techniques.

)(aaH

)(aaH

c

)(nh

c

highest

frequency

component

after Haa()

Page 20: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-51

Consider the following system:

is the highest frequency component to be retained after anti-aliasing filtering

The simple anti-aliasing filter has gradual cutoff but high attenuation at

Here is the approach:

1. Sample much higher than , say

2. Follow by sharp anti-aliasing filter in digital domain

3. Follow by decimation by M

N

NM

NM2N2

Page 21: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-52

simple

anti-aliasing

filter

sharp

anti-aliasing

filter

C/D

txc

txa

nx̂

nxd

M

NMT

1

)(CX

)(aaX

)(ˆ X

)(dX

Page 22: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-53

A/D Conversion

The A/D converter is an approximation to the C/D converter as shown below:

Sample

& HoldA/D

TT

txa

tx0

nxBˆ

Binary numbers of B bit accuracy

tho

T

t

n

aoo nTtnTxthtx

We would like the sampling to be

instantaneous and the hold to keep the

sample value constant for T-seconds.

1

Page 23: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-54

The next step in the conversion process is the quantizer and encoder. Although represented separately,

quantizing and encoding are usually one step

Quantizing – rounding off sample values to the nearest permissible value

Encoding – representing each permissible sample value with a binary digital number

The quantizer is a

nonlinear system

having this as its

input/output

characteristic

input dynamic range

This example is a

mid-tread quantizer

Page 24: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-55

Analysis of Quantization Errors

Quantization introduces error so that the quantized signal sample is an approximation.

Quantizer

Q nx nxQnx ˆ

where we can define the quantizing error as so that nxnxne ˆ

nx nenxnx ˆ

ne

+

22

ne

The quantizer error is bounded by

B

m

B

m XX

22

21

where

mX

mX2

is the full scale level

is the dynamic range

Page 25: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-56

A statistical representation is used to represent quantization error. This requires the following assumptions:

• The error sequence is a sample sequence of a stationary random process.

• The error sequence is uncorrelated with the sequence x(n).

• The error sequence is a white noise random process (i. e., error sequence samples are uncorrelated).

• The PDF of the error function is uniform over the range of quantization error.

ep

1

2

2

e

m

B X 2

2

2

222

12

1deee

12

2 222 m

B

e

X

The variance of the error

sequence is effectively the

quantizer “noise power”

in terms of the

quantizer parameters

Noise power alone is not the most useful way of characterizing the impact of quantizing error. The SQNR

is more valuable as a metric:

x

m

m

x

B

e

x XB

X

102

22

102

2

10 log208.1002.6212

log10log10SQNR

“signal power”

Page 26: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-57

x

m

m

x

B

e

x XB

X

102

22

102

2

10 log208.1002.6212

log10log10SQNR

SQNR increases 6 dB for each additional

bit of quantizer accuracy (i.e., doubling #

of quantizing levels)

2

cos1 2

2

0

2 AdtTA

T

T

ox

TAtx o cos

Adjust the amplitude of x(t) to extend across the dynamic range of the quantizer:

Example: A sinusoid

With signal power:

AX m

2log208.1002.6SQNR 10 B

79.702.6SQNR B

• if x > Xm clipping will occur

• when x gets smaller, the SQNR decreases

• the “optimum” case encompasses the entire signal,

• assuming Gaussian input, “optimal” is approx. by

Xm = 3 x which covers >99% of the signal

x =

√2

A

Can use to determine # bits needed to achieve a desired SQNR.

=> Remember to add a sign bit afterwards (this only accounts for interval [0 Xm], need to quantize over [–Xm Xm]

Page 27: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-58

D/A Conversion

Previously, for a bandlimited signal sampled at (or above) the Nyquist rate we showed that the ideal

analog reconstruction filter (or interpolation function) has the form

Note that the ideal reconstruction filter extends over all time. Hence, it is noncausal and

physically unrealizable. We now consider some practical reconstruction filters.

t

tth

T

Tr

sin

T

F

TT

H

S

r

,0

22,

hr(t)

t

T

rH

T T

Page 28: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-59

Zero-Order Hold

The simplest reconstruction filter is implemented by holding the sample value as constant

over the length of the sampling period T. Note that this is the same approach used for A/D

conversion.

hZOH(t)Lowpass

smoothing

filter

digital

input

signal

analog

output

signal

where

otherwise,0

0,1ZOH

Ttth

thZOH

T

t

sharp transition creates

undesirable high frequency

components, LPF to remove

TntnTnTxtx )1()()(ˆ

or

Page 29: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-60

First-Order Hold

First-order hold approximates x(t) by straight-line segments which have a slope that is determined

by the current sample x(nT) and the previous sample x(nTT).

hFOH(t)Lowpass

smoothing

filter

digital

input

signal

analog

output

signal

where

otherwise,0

2,1

0,1

FOH TtTT

t

TtT

t

th

or

TntnTnTtT

TnTxnTxnTxtx )1()(

)()()()(ˆ

while not as bad as ZOH,

FOH still requires LPF

because it generates undesirable

high frequency components

Page 30: In this case, no aliasing occurs and the decimation ...sdblunt/644/CourseNotes5C.pdf · Note that while decimation implied a shifting and scaling of the frequency axis, up-sampling

5-61

Linear Interpolation with Delay

This technique linearly extrapolates the next sample based on the samples x(nT) and x(nTT).

A one sample delay is required to avoid jumps at the sample points.

hLID(t)Lowpass

smoothing

filter

digital

input

signal

analog

output

signal

where

otherwise,0

2,2

0,

LID TtTT

t

TtT

t

th

or

TntnTnTtT

TnTxnTxTnTxtx )1()(

)()()()(ˆ

Note that all non-ideal reconstruction filters must be followed by LPF to remove the

distortions they induce.