Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and...

50
Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference equations, and so we cannot apply z-transform for their representation. However, they have apparent properties (frequency ‘expansion’ and ‘concentration’), and so frequency-domain analysis can still be performed. In particular, we can show that the following two systems are equivalent Interchange of Filtering and Downsampling/Upsampling equivalent systems

Transcript of Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and...

Page 1: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference equations, and so we cannot apply z-transform for their representation. However, they have apparent properties (frequency ‘expansion’ and ‘concentration’), and so frequency-domain analysis can still be performed. In particular, we can show that the following two systems are equivalent

Interchange of Filtering and Downsampling/Upsampling

equivalent systems

Page 2: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Why? In the frequency domain Also So

equivalent systems

Page 3: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Hence

A similar identity applies to upsampling

equivalent systems

Page 4: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Polyphase Decomposition

Polyphase decomposition of a sequence is obtained by representing it as a superposition of M sequences (0≤k<M)

Note that

… h[-M] 0 0 0 h[0] 0 0 0 h[M] 0 0 0 h[2M] ... .… 0… h[-M+1] 0 0 0 h[1] 0 0 0 h[M+1] 0 0 0 … …………………………………………………………………………………………………… +) ____________________________________________________ h(-M) h(-M+1) …… h[0] h[1] …………h[M] h[M+1] ……….h[2M]…

Page 5: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Define ek[n] to be

which are referred to as the polyphase components of h[n]. By z-transform and downsampling, we can reconstruct h[n] by the following figure

Page 6: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Since the delays (z-i) can be chained, we can also reconstruct h[n] by the following equivalent figure:

Page 7: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Consider the red-square part:

Page 8: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

From this part, we have the relationship of the inputs ek[n] (k= 0 to M-1) and the output h[n]. In the Z-domain, the relationship becomes:

It means that, the system (filter) H(z) can be decomposed into M parallel filters (addition of these filters).

More specifically, the system function H(z) is expressed as a sum of delayed polyphase component filters.

Page 9: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Hence, when input x[n] is applied to the system H(z), its diagram structure can be represented as

The time-domain interpretation of the above is straightforward. If H(z) is an FIR filter, then for each component, the required clock

rate (時脈) is M-times slower than that of the input. Less cost in digital circuits design.

Page 10: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Polyphase Implementation of Decimation Filters

Remember that, when performing downsampling, it is usually required a low-pass filter H(z) being performed beforehand, and the entire process is called decimation.

By decomposing the system function H(z) by its polyphase components, and note that the downsampling can be combined with each component, we have the diagram as follows:

(A)

Page 11: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Implementing the decimation filter using polyphase decomposition

Page 12: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

The above system performs downsamplings after the filtering, which is inefficient. According the interchange property of downsampling and filter, we have the following equivalent system that performs downsamplings beforehand:

(B)

Page 13: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Advantage: If H(z) is an N-point FIR filter In the original design (Figure A) for the decimation filter, it needs N multiplications and N-1 additions per unit time. In the polyphase-decomposition design (Figure B) for the decimation filter, each filter Ek(z) is of length N/M. Each filter requires, per unit time, (1/M)(N/M) multiplications and (1/M)((N/M) - 1) additions. Hence, Figure B requires N/M multiplications and (N/M)-1+M-1 additions.

per unit time.

Polyphase decomposition principle has been used for music recording (such as polyphase suband coding in MP3), and DSP ASIC(Application Specific IC) for CD players, such as NPC-SM5813.

Page 14: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Similar to the decimation case, polyphase decomposition principle can be applied to the interpolation filter too.

Polyphase Implementation of Interpolation Filters

NL multiplications and NL-1 additions per unit time

L(N/L) multiplications and L((N/L)-1) + L-1 additions per unit time

Page 15: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Correlation Given a pair of sequences x[n] and y[n], their cross correlation sequence is rxy[l] is defined as

for all integer l. The cross correlation sequence can help measure similarities

between two signals. For power signal:

[ ] [ ] [ ]∑∞

−∞=

−=n

xy lnynxlr

Page 16: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Cross correlation is very similar to convolution, unless the indices changes from l − n to n − l. Relation between cross correlation and convolution:

Autocorrelation

For power signal:

[ ] [ ] [ ]∑∞

−∞=

−=n

xx lnxnxlr

Page 17: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Consider the following non-negative expression:

That is,

Thus, the matrix is positive semidefinite.

Its determinate is nonnegative.

Properties

[ ] [ ]( ) [ ] [ ] [ ] [ ]

[ ] [ ] [ ] 0020

2

2

2222

≥++=

−+−+=−+ ∑∑∑∑∞

−∞=

−∞=

−∞=

−∞=

yyxyxx

nnnn

rlarra

lnylnynxanxalnynax

[ ] [ ] [ ][ ] [ ] a

arlr

lrra

yyxy

xyxx allfor 010

01 ≥

[ ] [ ][ ] [ ]

0

0

yyxy

xyxx

rlrlrr

Page 18: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

The determinant is rxx[0]ryy[0] − rxy2[l] ≥ 0.

Properties rxx[0]ryy[0] ≥ rxy

2[l] rxx

2[0] ≥ rxx2[l]

Normalized cross correlation and autocorrelation:

The properties imply that |ρxx[0]|≤1 and |ρyy[0]|≤1. This property can also be explained by Schwartz inequality. Consider x and y to be two infinite-length vectors. Then rxx[0]

and ryy[0] are the squared lengths of x and y, respectively. rxy[l] is the inner product between x[n] and y[n-l].

From Schwartz inequality, similar property holds for the inner product of x and any vector consisting of a reshuffle of the elements of y.

[ ] [ ][ ] [ ] [ ]

[ ] [ ]00

0 yyxx

xyxy

xx

xxxx

rr

lrl

rlrl == ρρ

Page 19: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

For two signals having the same autocorrelations, what’s their common property?

Property in the frequency domain The DTFT of the autocorrelation signal rxx[l] is the squared

magnitude of the DTFT of x[n], i.e., |X(ejw)|2. That is

Hence, signals with the same autocorrelation share the same magnitude spectrum in the frequency domain, albeit their phases are different. An example of describing the property of a class of signals.

Autocorrelation is quite often be used for finding the period of a periodical signal. By definition, autocorrelation peaks at the integer multiples of the period.

Correlation is useful in random signal modeling and processing

Page 20: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

We will represent the spectrum of DTFT either by H(ejwT) or more often by H(ejw) for convenience. When represented as H(ejw), it has the frequency range [-π,π]. In this case, the frequency variable is to be understood as the normalized frequency. The range [0, π] corresponds to [0, ws/2] (where wsT=2π), and the normalized frequency π corresponds to the Nyquist frequency (and 2π corresponds to the sampling frequency).

DTFT continue (c.f. Shenoi, 2006)

Page 21: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

DC response When w=0, the complex exponential e−jw becomes a constant signal, and the frequency response X(ejw) is often called the DC response when w=0.

–The term DC stands for direct current, which is a constant current.

DTFT Properties Revisited

Time shifting

Page 22: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Frequency shifting Time reversal

Page 23: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

DTFT of δ(n)

DTFT of δ(n+k)+ δ(n-k)

According to the time-shifting property,

Hence

( ) jwnn

nen −

−∞=∑δ

( ) ( ) jwkjwk eknekn −−+ is of DTFT , is of DTFT δδ

( ) ( ) ( )wkeeknkn jwkjwk cos2 is of DTFT =+−++ −δδ

10 == jwe

Page 24: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

DTFT of x(n) = 1 (for all n)

x(n) can be represented as

We prove that its DTFT is

Page 25: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Hence ( ) dwekw jwn

k∫ ∑−

−∞=

π

ππδ 2

( ) ( ) ( ) ( )dwwdwwdwwdww ∫∫∫∫∞

∞−−++==

π

π

π

ππ

πδδδδ

( ) dwkwk

∫ ∑−

−∞=

−=

π

ππδ 2

( ) ndww allfor 1== ∫∞

∞−δ

Page 26: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

From another point of view According to the sampling property: the DTFT of a continuous signal xa(t) sampled with period T is obtained by a periodic duplication of the continuous Fourier transform Xa(jw) with a period 2π/T = ws and scaled by T. Since the continuous F.T. of x(t)=1 (for all t) is δ(t), the DTFT of x(n)=1 shall be a impulse train (or impulse comb), and it turns out to be

DTFT of anu(n) (|a|<1)

let then This infinite sequence converges to when |a|<1.

Page 27: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

DTFT of Unit Step Sequence

Page 28: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Adding these two results, we have the final result

Page 29: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Differentiation Property

Page 30: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

DTFT of a rectangular pulse

Page 31: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

and get

Page 32: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Discrete Fourier Transform (DFT)

Currently, we have investigated three cases of Fourier transform,

Fourier series (for continuous periodic signal)

Continuous Fourier transform (for continuous signal)

Discrete-time Fourier transform (for discrete-time signal)

All of them have infinite integral or summation in either time or frequency domains.

Page 33: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

There still is another type of Fourier transform:

Consider a discrete sequence that is periodic in the time domain (eg., it can be obtained by a periodic expansion of a finite-duration sequence, ie., we image that a finite-length sequence repeats, over and over again, in the time domain). Then, in the frequency domain, the spectrum shall be both periodic and discrete, ie, the frequency sequence is also made up of a finite-length sequence, which repeats over and over again in the frequency domain. Considering both the finite-length (or finite-duration) sequences in one period of the time and frequency domains, leads to a transform called discrete Fourier transform.

Page 34: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

From Kuhn 2005

Page 35: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

From Kuhn 2005

Page 36: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Four types of Fourier Transforms

Time domain non-periodic

Time domain periodic

Frequency domain non-periodic

Continuous Fourier transform (both domains are continuous)

Fourier series (time domain continuous, frequency domain discrete)

Frequency domain periodic

DTFT (time domain discrete, frequency domain continuous)

DFT/DTFS (time domain discrete, frequency domain discrete, and both finite-duration)

Page 37: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

DFT and DTFT – A closer look

We discuss the DTFT-IDTFT pair (‘I’ means “inverse) for a discrete-time function given by and The pair and their properties and applications are elegant, but from practical point of view, we see some limitations; eg. the input signal is usually aperiodic and may be infinite in length.

Page 38: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Example of a finite-length x(n) and its DTFT X(ejw).

A finite-length signal

Its magnitude spectrum

Its phase spectrum

Page 39: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

The function X(ejw) is continuous in w, and the integration is not suitable for computation by a digital computer.

We can discretize the frequency variable and find discrete values for X(ejwk), where wk are equally sampled whthin [-π, π]. Discrete-time Fourier Series (DFS) Let x(n) (n∈Z) be a finite-length sequence, with the length being N; i.e., x(n) = 0 for n < 0 and n > N. Consider a periodic expansion of x(n): xp(n) is periodic, so it can be represented as a Fourier series:

( ) ( ) integerany is ,1,...,1,0 , KnnnxKNnxp −==+

Page 40: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

To find the coefficients Xp(k) (with respect to a discrete periodic signal), we use the following summation, instead of integration:

First, multiply both sides by e-jmw0k (w0=2π/k), and sum over n from n=0 to n=N-1: By interchanging the order of summation, we get

Page 41: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Noting that

pf. When n=m, the summation reduces to

N

When n≠m, by applying the geometric-sequence formula,

we have

( ) ( ) ( )( ) ( )

( )

( ) ( ) ( )

( ) 01

1

/2

)(/2)(/22

/2

)(/2)(/21

'

'/21

0

/2

=−−

=

−−

==

−−+

−−−−

−=

=

− ∑∑

kNj

mkNjmkNjkj

kNj

mkNjmNkNjmN

mn

knNjN

n

mnkNj

eee

eeeee

π

πππ

π

ππππ

1 ,1

1

≠−−

=−+

−=∑ r

rrrr

MNN

Mn

n

Page 42: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Since there is only one nonzero term,

= Xp(k)N

The final result is The following pairs then form the DFS

Page 43: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Relation between DTFT and DFS for finite-length sequences

We note that

Main property: In other words, when the DTFT of the finite length sequence x(n) is evaluated at the discrete frequency wk = (2π/N)k, (which is the kth sample when the frequency range [0, 2π] is divided into N equally spaced points) and dividing by N, we get the Fourier series coefficients Xp(k).

DTFT spectrum DFS coeficient

Page 44: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

A discrete-time periodic signal

Its magnitude spectrum (sampled)

Its phase spectrum (sampled)

Page 45: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

To simplify the notation, let us denote

The DFS-IDFS (‘I’ means “inverse”) can be rewritten as (W=WN)

Discrete Fourier Transform (DFT) Consider both the signal and the spectrum only within one period (N-point signals both in time and frequency domains)

( )NjN eW /2π−=

DFT

IDFT (inverse DFT)

Page 46: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Relation between DFT and DTFT: The frequency coefficients of DFT are the N-point uniform samples of DTFT with [0, 2π].

The two equations DFT and IDFT give us a numerical algorithm to obtain the frequency response at least at the N discrete frequencies. By choosing a large value N, we get a fairly good idea of the frequency response for x(n), which is a function of the continuous variable w.

Question: Can we reconstruct the DTFT spectrum (continuous in w) from the DFT?

→ Since the N-length signal can be exactly recovered from both the DFT coefficients and the DTFT spectrum, we expect that the DTFT spectrum (that is within [0, 2π]) can be exactly reconstructed by the DFT coefficients.

Page 47: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

Reconstruct DTFT from DFT (when the sequence is finite-length)

By substituting the inverse DFT into the x(n), we have

a geometric sequence

Page 48: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

By applying the geometric-sequence formula

Page 49: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

So

The reconstruction formula

Page 50: Interchange of Filtering and Downsampling/Upsamplingdsp/dsp2011/slides... · Downsampling and upsampling are linear systems, but not LTI systems. They cannot be implemented by difference

In summary

If x[n] is a finite-length sequence (n≠0 only when |n|<N) , its DTFT X(ejw) shall be a periodic continuous function with period 2π. The DFT of x[n], denoted by X(k), is also of length N. where , and Wn are the the roots of Wn = 1.

Relationship: X(k) is the uniform samples of X(ejw) at the discrete frequency wk = (2π/N)k, when the frequency range [0, 2π] is divided into N equally spaced points.

( )nNjeW /2π−=