Downsampling, Upsampling, and Reconstruction - CppSim

0 downloads 151 Views 404KB Size Report
Conversion of analog signals to the digital domain. – Conversion of digital signals to the analog domain. – Downsamp
Downsampling, Upsampling, and Reconstruction • • • • • M.H. Perrott©2007

A-to-D and its relation to sampling Downsampling and its relation to sampling Upsampling and interpolation D-to-A and reconstruction filtering Filters and their relation to convolution Copyright © 2007 by M.H. Perrott All rights reserved.

Downsampling, Upsampling, and Reconstruction, Slide 1

Digital Processing of Analog Signals xc(t)

x[n]

A-to-D Converter

Downsample by N

1/T Sample/s

r[n]

1/(NT) Sample/s

Digital Signal Processing Operations

u[n]

1/(NT) Sample/s

yc(t)

Upsample by M

D-to-A Converter

M/(NT) Sample/s

M/(NT) Sample/s

• Digital circuits can perform very complex processing of analog signals, but require – Conversion of analog signals to the digital domain – Conversion of digital signals to the analog domain – Downsampling and upsampling to match sample rates of A-to-D, digital processor, and D-to-A

M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 2

Inclusion of Filtering Operations xc(t)

x[n]

A-to-D Converter Analog Anti-Alias Filter

1/T Sample/s

r[n]

Anti-Alias Filter

Downsample by 10

1/T Sample/s

1/(NT) Sample/s

Digital Signal Processing Operations

u[n]

1/(NT) Sample/s

Upsample by 10

Interpolate with Filter

M/(NT) Sample/s M/(NT) Sample/s

y[n]

yc(t)

D-to-A Converter M/(NT) Sample/s

Analog Reconstruction Filter

• A-to-D and downsampler require anti-alias filtering – Prevents aliasing

• D-to-A and upsampler require interpolation (i.e., reconstruction) filtering – Provides `smoothly’ changing waveforms

M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 3

Summary of Sampling Process (Review) p(t) 1 t p(t)

T xp(t)

xc(t) xc(t)

x[n]

Impulse Train to Sequence

xp(t)

x[n]

t

t

n

T Xc(f)

f 0

Xp(f)

A T

A

1

-2 T

-1 T

0

X(ej2πλ)

A T 1 T

2 T

f -2

-1

0

1

2

λ

• Sampling leads to periodicity in frequency domain

M.H. Perrott©2007

We need to avoid overlap of replicated signals in frequency domain (i.e., aliasing)

Downsampling, Upsampling, and Reconstruction, Slide 4

The Sampling Theorem (Review) p(t)

xc(t)

xp(t)

1 t

t

t

T

Xc(f)

P(f)

f

-2 T

-1 T

0

Xp(f)

A T

1 T

A

-fbw fbw

T

1 T

2 T

f

-2 T

-1 T

0

1 T

-fbw fbw 1 - fbw - 1 + fbw T T

2 T

f

• Overlap in frequency domain (i.e., aliasing) is avoided if: • We refer to the minimum 1/T that avoids aliasing as the Nyquist sampling frequency

M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 5

A-to-D Converter xc(t)

xc(t) Analog Anti-Alias Filter

x[n]

A-to-D Converter 1/T Sample/s

1 t p(t) xc(t) t

T xp(t) Quantize xp(t) Value

x[n]

Impulse Train to Sequence

t T

n 1

• Operates using both a sampler and quantizer

– Sampler converts continuous-time input signal into a discrete-time sequence – Quantizer converts continuous-valued signal/sequence into a discrete-valued signal/sequence • Introduces quantization noise as discussed in Lab 4

M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 6

Frequency Domain View of A-to-D xc(t)

xc(t)

Analog Anti-Alias Filter 1/T

Xc(f) 1 0

x[n]

A-to-D Converter 1/T Sample/s

P(f)

f -1/T 0 1/T p(t) xp(t) Quantize xp(t) xc(t) Value f Xp(f) 1/T -2/T -1/T

0

1/T

2/T

f

Impulse Train to Sequence

x[n] X(ej2πλ)

1/T -2

-1

0

1

2

λ

• Analysis of A-to-D same as for sampler – For simplicity, we will ignore the influence of quantization noise in our picture analysis • In lab 4, we will explore the influence of quantization noise using Matlab M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 7

Downsampling Anti-Alias Filter

x[n]

N

p[n]

Downsample r[n] by N

1

x[n]

r[n] Remove Zero Samples

xs[n]

n 1

n

n N

1

• Similar to sampling, but operates on sequences • Analysis is simplified by breaking into two steps

– Multiply input by impulse sequence of period N samples – Remove all samples of xs[n] associated with the zerovalued samples of the impulse sequence, p[n] • Amounts to scaling of time axis by factor 1/N

M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 8

Frequency Domain View of Downsampling Anti-Alias Filter

x[n]

Downsample r[n] by N

P(ej2πλ) 1/N

1 -1

-1 -2/N -1/N 0 1/N 2/N p[n] j2πλ X(e ) xs(t) x[n] 1

0 1/N

1

λ r[n] Remove Zero Samples

λ

R(ej2πλ)

Xs(ej2πλ)

-1 -2/N -1/N 0 1/N 2/N

1/N 1

λ

-1

0

1

λ

• Multiplication by impulse sequence leads to replicas of input transform every 1/N Hz in frequency • Removal of zero samples (i.e., scaling of time axis) leads to scaling of frequency axis by factor N M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 9

The Need for Anti-Alias Filtering Anti-Alias Filter

x[n]

Downsample r[n] by N

P(ej2πλ) 1/N

Undesired Signal or Noise

1 -1

-1 -2/N -1/N 0 1/N 2/N p[n] j2πλ X(e ) xs(t) x[n] 1

0 1/N

1

λ r[n] Remove Zero Samples

λ

R(ej2πλ)

Xs(ej2πλ)

-1 -2/N -1/N 0 1/N 2/N

1/N 1

λ

-1

0

1

λ

• Removal of anti-alias filter would allow undesired signals or noise to alias into desired signal band What is the appropriate bandwidth of the anti-alias lowpass filter? M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 10

Upsampler u[n]

u[n] n

Upsample by N

up[n]

Interpolate with Filter

up[n]

Add Zero Samples

y[n]

Interpolate with Filter

y[n]

1 n 1

N

n 1

N

• Consists of two operations

– Add N-1 zero samples between every sample of the input • Effectively scales time axis by factor N – Filter the resulting sequence, up[n], in order to create a smoothly varying set of sequence samples • Proper choice of the filter leads to interpolation between the non-zero samples of sequence up[n] (discussed in Lab 5)

M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 11

Frequency Domain View of Upsampling u[n]

u[n] U(ej2πλ)

Upsample by N

up[n]

Add Zero Samples

Interpolate with Filter

up[n]

y[n]

Interpolate with Filter

1

1/N -1

0

y[n]

1

λ 1/N

-1

Up(ej2πλ)

-1 -2/N -1/N 0 1/N 2/N

1

Y(ej2πλ)

0

1

λ

λ

• Addition of zero samples (scaling of time axis) leads to scaling of frequency axis by factor 1/N • Interpolation filter removes all replicas of the signal transform except for the baseband copy M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 12

D-to-A Converter n

1/T Sample/s

1

yc(t)

yc(t) D-to-A Converter

y[n]

Analog Reconstruction Filter

t

n 1

y[n]

Sequence to Impulse Train

yc(t)

T

• Simple analytical model includes two operations – Convert input sequence samples into corresponding impulse train – Filter impulse train to create a smoothly varying signal • Proper choice of the reconstruction filter leads to interpolation between impulse train values M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 13

Frequency Domain View of D-to-A Y(ej2πλ)

-2

-1

0

1

yc(t) D-to-A Converter

y[n]

1/T 2

λ

1/T Sample/s

yc(t)

f

Y(f)

1/T -1

Yc(f)

0

Analog Reconstruction Filter

Y(ej2πλ)

-2

1

1/T 0

1

2

λ

y[n]

Sequence to Impulse Train

yc(t) -2/T -1/T

0

1/T

2/T

f

• Conversion from sequence to impulse train amounts to scaling the frequency axis by sample rate of Dto-A (1/T) • Reconstruction filter removes all replicas of the signal transform except for the baseband copy M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 14

A Common Reconstruction Filter yc(t) D-to-A Converter

y[n] n

1/T Sample/s

1

Hzoh(f)

yc(t) t

Zero-Order Hold

T

t

n 1

y[n]

Sequence to Impulse Train

yc(t)

T

• Zero-order hold circuit operates by maintaining the impulse value across the D-to-A sample period – Easy to implement in hardware

How do we analyze this? M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 15

Filtering is Convolution in Time yc(t)

yc(t)

Hzoh(f) t

t Zero-Order Hold

T

T hzoh(t) t

T

yc(t)

hzoh(t)

t

t

t T

yc(t)

T

T

• Recall that multiplication in frequency corresponds to convolution in time

• Filtering corresponds to convolution in time between the input and the filter impulse response

M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 16

Frequency Domain View of Filtering yc(t)

yc(t)

Hzoh(f) t

t Zero-Order Hold

T

T hzoh(t) t

T

yc(t)

hzoh(t)

yc(t) t

t

t T

T

T

Hzoh(f)

Yc(f) -2 T -2 T

-1 T

0

1 T

2 T

Yc(f) 2 T

f

f -1 T

0

1 T

f -2 T

-1 T

0

1 T

2 T

• Zero-order hold is not a great filter, but it’s simple…

M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 17

Summary • A-to-D converters convert continuous-time signals into sequences with discrete sample values – Operates with the use of sampling and quantization

• D-to-A converters convert sequences with discrete sample values into continuous-time signals – Analyzed as conversion to impulse train followed by reconstruction filtering • Zero-order hold is a simple but low performance filter

• Upsampling and downsampling allow for changes in the effective sample rate of sequences – Allows matching of sample rates of A-to-D, D-to-A, and digital processor – Analysis: downsampler/upsampler similar to A-to-D/D-to-A

• Up next: digital modulation M.H. Perrott©2007

Downsampling, Upsampling, and Reconstruction, Slide 18

Suggest Documents