Você está na página 1de 29

DSP

Chapter 4 Sampling of Continuous-time Signals


Advantages of digital signal processing, e.g., audio/video CD.
Things to look at:
Continuous-to-discrete (C/D)
Discrete-to-continuous (D/C) perfect reconstruction
Frequency-domain analysis of sampling process
Sampling rate conversion

4.1 Periodic Sampling


Ideal continuous-to-discrete-time (C/D) converter

xc (t)

x[n]
C/D

xc (t )

T=1, x[n ] xc ( nT )

T=2, x[n ] xc ( nT )

Chapter 4

DSP

Continuous-time signal: xc (t )
Discrete-time signal: x[n] xc (nT ), n , T: sampling period
How to model this C/D process?
In theory, we break the C/D operation into two steps:
(1) Ideal sampling using analog delta function (impulse)
(2) Conversion from impulse train to discrete-time sequence
Step (1) can be modeled by mathematical equation.
Step (2) is a concept, no mathematical model.
In reality, the electronic analog-to-digital (A/D) circuits can approxmate the ideal C/D operation. This circuitry is one piece; it cannot be
split into two steps.

Ideal sampling
xc (t )

xs (t )

Sampling

s (t )

xc (t )

xs (t )

Conversion from
impulse train
to discrete-time
sequence

x[n]

Ideal sampling signal: impulse train (an analog signal)


s t

t nT , T: sampling period

Chapter 4

DSP

Analog (continuous-time) signal: xc (t )


Sampled (continuous-time) signal: xs (t )

x s t xc t s t xc t t nT
n

xc t t nT xc nT t nT

4.2 Frequency-domain Representation of Sampling


2
s t S j
T

k s

, where s 2 / T

Remark: : analog frequency (radians/s)

: discrete (normalized) frequency (radians/sample)


T ; ,

Step 1: Ideal Sampling (all in analog domain)

1
1
X s j
X c j S j X c j k s
2
T
k

1
1

X c j k s T X c j k s
T k
k

The sampled signal spectrum is the sum of shifted copies of the original.
Remark: In analog domain,
x(t ) y (t ) X ( f ) * Y ( f )

1
X ( j ) * Y ( j )
2

Step 2: Analog Impulses to Sequence (analog to discrete-time)

No mathematical model. The spectrum of xs (t ) , X s ( j) , is the


Chapter 4

DSP

same as the spectrum of x[n] , X (e jT ) . (See the Appendix


at the end.)
Now, X (e

jT

1
) X c j k s
T k

1
2k
Thus, X (e ) X c j

T k T
T
j

Remark: In time domain, xs (t ) and x[n] are two very different signals
but they have the same spectra in frequency domain.
Two Cases:
(1) no aliasing: s 2 N , and
(2) aliasing: s 2 N , where N is the highest nonzero frequency component of X c ( j) .
After sampling, the replicas of X c ( j) overlap (in frequency
domain). That is, the higher frequency components of X c ( j)
overlap with the lower frequency components of
X c j ( s ) .
(Fig. 4.3 on O&S, p.186)
xs(t)

xc(t)

t
T

FT

FT
Xs(j)

Xc(j)

N
Chapter 4

S
4

DSP

Nyquist Sampling Theorem: Let x(t) be a bandlimited signal with

X c ( j) 0 for | | N . (i.e., no components at frequencies greater


than N ) Then xc (t ) is uniquely determined by its samples
x[n] xc (nT ), n 0,1,2, , if s

2
2 N . (Nyquist, Shannon)
T

-- Nyquist frequency = N , the bandwidth of signal.


-- Nyquist rate = 2 N , the minimum sampling rate without distortion. (In some books, Nyquist frequency = Nyquist rate.)
-- Undersampling: s 2 N
-- Oversampling: s 2 N

4.3 Reconstruction of a Bandlimited Signal from Its


Samples
-- Perfect reconstruction: recover the original continuous-time
signal without distortion, e.g., ideal lowpass (bandpass) filter
x[n]

Convert from
Sequence to
Impulse train

xs (t )

Reconstruction
filter

xr (t )

Based on the frequency-domain analysis, if we can clip one


copy of the original spectrum, X c ( j) , without distortion, we can
achieve the perfect reconstruction. For example, we use the ideal
low-pass filter as the reconstruction filter.
Remark: Note that xs (t ) is an analog signal (impulses).
xc (t ) sampling xs (t ) x(nT ) (t nT ) seq. convr. x[n]

Chapter 4

DSP

x[n] impulse convr. xs (t ) x[n] (t nT ) recon. xr (t )

xr (t ) xs (t ) hr (t ) x[n] ( nT )hr (t )d

x[n]

( nT )hr (t )d

x[n]hr (t nT )

Ideal low-pass reconstruction filter:


1 T T
H r ( j)
otherwise
0

hr (t )

sin(t T )
(t T )
hr(t)

Chapter 4

2T

DSP

Is xr (t ) xc (t ) ?
Proof in (1) frequency domain (clear!),
in (2) time domain?
(A) Check t nT
n0
1,
hr (t )
0, n 1,2,

xr (t ) x[n] xc (t )

(B) Check kT t (k 1)T (Fig.4.8 on p.194)


xr (t ) x[n]

sin (t nT ) / T
(t nT ) / T

This is an interpolation a weighted sum of x[n]s. Note that in


general we need infinite terms to reproduce xc (t ) . In practice,
only the near-by terms matter. (We will later discuss the zero-order hold interpolator.)

4.4 Discrete-Time Processing of Continuous-Time


Signals
xc (t )

x[n]

C/D

Discrete-time
system
H ( e j )

y[n]

D/C

yr (t )

H eff ( j)

If this is an LTI system,

(1)

Chapter 4

x[n] y[n] : Y (e j ) H (e j ) X (e j )

DSP

2k
j

T
T

(2)

xc (t ) x[n] : X (e ) X c
T k

(3)

y[n] yr (t ) : Yr ( j) H r ( j)Y (e jT )

Note that T is included in the expression of Y (e j ),

T . This means physical frequency (not normalized).


(4)

xc (t ) yr (t ) :
Yr ( j) H r ( j) H (e jT ) X (e jT )

H r ( j ) H ( e

jT

1
2k

) X c j j

T k
T

If H r ( j) is an ideal low-pass filter, then


H (e jT ) X c ( j), | | / T
Yr ( j)
0,
otherwise

In other words, if xc (t ) is bandlimited and is ideally sampled at a rate


above the Nyquist rate, and the reconstruction filter is the ideal
low-pass filter, then the equivalent analog filter has the same spectrum shape of the discrete-time filter.
H (e jT ), | | / T
H eff ( j)
otherwise
0,

Remark: In order to have the above equivalent relation between


H (e j ) and H eff ( j) , we need
(i) The system is LTI;
(ii) The input is bandlimited;
(iii) The input is sampled without aliasing and the ideal impulse
train is used in sampling;
(iv) The ideal reconstruction filter is used to produce the analog
output.
In practice, the above conditions are only approximately valid at best.
Chapter 4

DSP

However, there are methods in designing the sampling and the reconstruction processes to make the approximation better.
Impulse invariance
A filter design method design a discrete-time filter that approximates an analog filter. We simply sample the analog filter impulse
response h[n] Thc (nT ) . (Details will be discussed in the filter design chapter.)

4.5 Continuous-Time Processing of Discrete-Time


Signals
x[n]

xc (t )

D/C

Continu.-time
system

yc (t )

y[n]
C/D

H c ( j )

H ( e j )

X c ( j) TX (e jT ),

Yc ( j) H c ( j) X c ( j),

Y (e j )

Chapter 4

1
Yc ( j ),
T
T

DSP

Y(e j ) Hc ( j ) Xc ( j ) Hc ( j ) X (e j )
T
T
T
T
H (e j ) H c ( j

H ( e jT ) H c ( j)

or, equivalently,

Example: Noninteger Delay

H (e j ) e j


xc(t)

x[n]

n
yc(t) = xc(t-T)

y[n]

n
y[n ] y c ( nT ) x c ( nT T )

x[k ]

sin[ (t T kT ) / T ]
|t nT
(t T kT ) / T

x[k ]

sin[ ( n k )]
(n k )

Chapter 4

10

DSP

4.6 Change the Sampling Rate Using Discrete-time


Processing
xc (t )

T x[n] xc (nT )
T ' x'[n] xc (nT ' )

Original sampling period: T


New sampling period: T '
T T'
How to do it if we dont go back to the continuous-time signal?
Sampling rate reduction by an integer factor
Sampling rate compressor: T ' MT , where M is an integer
xd [n] x[nM ] xc (nMT )
x[n]

~
x [ n]

Lowpass filter
Cutoff= M

xd [ n] ~
x [nM ]

T=MT

1
X c ( j)
T1

FT

t
2
T1

T1

Downsampling

1
X c ( j)
T2

FT

t
T2 = MT1

Chapter 4

2
T2

11

DSP

(1)Aliasing: If the original signal BW is not small enough to meet the


Nyuist rate requirement, prefiltering is needed.
(2) Downsampling: The time-domain equation is simple as shown in
the above. How does it look like in frequency domain?
The Original
The Downsampled
1
2k
X (e ) X c j

T k T
T
j

1
2r
X d (e )
X c j

T ' r T ' T '


j

0 1 2 ( M 1) M
r
2
1
i ( M 2) ( M 1) 0 1 2 ( M 1) 1
1
1
0 0 0
0
1
k

Old and new index:

( M 1)
2

r i kM

r ,,2,1,0,1,2,,

k ,,2,1,0,1,2,,

i 0,1,2, , M 1

X d (e )
Xc

T ' r
j

2r
j

'
'
T
T

1
2r

X
j

c
MT r MT MT
1 M 1

Xc
MT k i 0
X d (e

1
)
M

2kM 2i

j

MT
MT
MT

2k
1
2i
T X c j MT j T

i 0 k

M 1

j 2i
X e M M
i 0

The downsampled spectrum = sum of shifted replica of the original


(Fig. 4.21: (1) shape expands; (2) replicas are inserted)
1

Chapter 4

M 1

12

DSP

Chapter 4

13

DSP

Chapter 4

14

Increasing sampling rate by an integer factor


Sampling rate expander T '= T / L , where L is an integer

T
xi [ n] = x c n
L

(Fig. 4.23: (1) shape is compressed; (2) replicas are removed)


(1) Increase samples
<Time-domain>

x[ n ], n = 0, L,2 L,
x e [n] = L
otherwise
0,
=

x[k ] [n kL]

k =

<Frequency-domain>


X e (e ) = x[k ] [n kL] e jn

n = k =
j


= x[k ] [n kL]e jn = X (e jL )

n=
k =

Note that

[n kL]e jn

n =

= e jLk

Remark: Essentially, the horizontal frequency axis is compressed.

old _ = T ,
new _ = T ' = T L , old _ = new _ L
Remark: At this point, we only insert zeros into the original signal.
In time domain, this signal doesnt look like the original.
The shape of the spectrum is not changed.

(2) Ideal lowpass filtering


<Frequency-domain>
L (TL) < (TL)
H i ( j) =
otherwise
0
<Time-domain>

hi [n] =
xi [ n] =

(Fig. 4.26, insert new samples)

sin(n L)
, an interpolator!
(n L)

k =

x[k ]

sin[ (n kL) / L]
(n kL) / L

Linear interpolation

1 | n | / L,
| n | L
hlin [n] =
otherwise
0,

Fig. 4.25

1 sin(L 2)
H lin (e j ) =
L sin( 2)

xlin [n] =

x[k ]hlin [n kL]

k =

(Fig. 4.26, linear interpolation with L=5)

Figure 4.26 (a) Illustration of linear interpolation by filtering. (b) Frequency


response of linear interpolator compared with ideal lowpass interpolation filter.

Changing sampling rate by a rational factor


Idea: Sampling period

ion
T interpolat

M
T
L

T decimation M
T
L
L

Figure 4.29

(a) System for changing the sampling rate by a noninteger factor.


(b) Simplified system in which the decimation and interpolation filters are
combined.

Remark: In general, if the factor is not rational, go back to the


continuous signals.

Figure 4.30

Illustration of changing the sampling rate by a noninteger factor.

In summary:
-- Sampling
Time-domain
Prefiltering

Frequency -domain
Limit bandwidth s > 2 N

Analog sampling (impulse train) Duplicate and shift ()


Analog to discrete (t ) [n]

-- Reconstruction
Time-domain

Frequency -domain

Discrete to analog [n] (t )


Interpolation

Remove extra copies ()

-- Down-sampling
Time-domain

Frequency -domain

Prefiltering

Limit bandwidth

Drop samples (rearrange index)

Expand (by a factor of M) and


duplicate (insert (M-1) copies)

-- Up-sampling
Time-domain
Insert zeros
Interpolation

Frequency -domain
Shrink (by a factor of L)
Remove extra copies in a 2
period

4.7 Digital Processing of Analog Signals


Ideal C/D converter (approximation) analog-to-digital (A/D)
converter
Ideal D/C converter (approximation) digital-to-analog (D/A)
converter

Prefiltering to Avoid Aliasing


Ideal antialiasing filter: Ideal low-pass filter (difficult to implement
sharp-cutoff analog filters).
A solution: simple prefilter and oversampling followed by sharp
antialiasing filters in discrete-time domain (Fig. 4.50)

Fig. 4.48

A/D Conversion
Digital: discrete in time and discrete in amplitude
Ideal sample-and-hold: (Fig. 4.46) Sample the (input) analog
signal and hold its value for T seconds.

x0 (t ) =

x[n]h0 (t nT )

n =

1, 0 < t < T
h0 (t ) =
0, otherwise
Fig. 4.51

Quantization: (Fig. 4.53) Transform the input sample x[n] into


one of a finite set of prescribed values.
x[n] = Q( x[n]) , x[n] is the quantized sample
Note: Quantization is a non-linear operation.

(i) Uniform quantizer uniformly spaced quantization levels; very


popular (also called linear quantizer)
(ii) Nonuniform quantizer may be more efficient for certain
applications
Parameters in a quantizer
(1) Decision levels partition the dynamic range of input signal
(2) Quantization (representation) levels the output values of a
quantizer; a quantization level represents all samples between
two nearby decision levels
(3) Full-scale level the quantizer input dynamic range
Note: Typically, when the decision levels are first chosen, then the
best quantization levels are decided (for a given input probability
distribution). On the other hand, when the quantization levels are
chosen, the best decision levels are decided.
Quantization error analysis
For a uniform quantizer, there are two key parameters:
(i) step size , and (ii) full-scale level ( X m )
Assume (B+1) bits are used to represent the quantized values.

2X m X m
= B
B +1
2
2

Quantization error: e[n] = x[n] x[n]


= quanitized value true value
It is clear that

< e[n] < .


2
2

Figure 4.54

Typical quantizer for A/D conversion.

Statistical characteristics of e[n] :


(1) e[n] is stationary (probability distribution unchanged)
(2) e[n] is uncorrelated with x[n]
(3) e[n] , e[n + 1] , are uncorrelated (white)
(4) e[n] has a uniform distribution
The preceding assumptions are (approximately) valid if the signal is
sufficiently complex and the quantization steps are sufficiently
small,
Mean square error (MSE) of e[n] (= variance if zero mean)

( e ) = E (e e )
2

1
2
= / 2 e
de =

12
/2

-- Expressed in terms of 2 B and X m

2 2 B X m2
=
12
2
e

-- SNR (signal-to-noise ratio) due to quantization

Xm
12 2 2 B x2
x2
SNR = 10 log10 2 = 10 log10
B
=
10
.
8
+
6
.
02

20
log
10
x
X m2
e
Remarks: (1) One bit buys a 6dB SNR improvement.
(2) If the input is Gaussian, a small percentage of the input samples
would have an amplitude greater than 4 x . If we choose

X m = 4 x , SNR 6 B 1.25dB
For example, a 96dB SNR requires a 16-bit quantizer.
D/A Conversion
The ideal lowpass filter is replaced by practical filters.
Examples of practical filters: zero-order hold and first-order hold.
Mathematical model: (Fig. 4.62)

x DA (t ) =

x[n]h0 (t nT )

n =

= quantized input * impulse response of practical interpolation


filter

x DA (t ) =

n =

n =

x[n]h0 (t nT ) + e[n]h0 (t nT )

= x0 (t ) + e0 (t )

~
Purpose: Find a compensation filter hr (t ) to compensate for the
distortion caused by the non-ideal h0 (t ) so that its output x r (t )
is close to the analog original x a (t ) .
x[n]

x DA (t )
D/A
Converter

Compensated
reconstruction
~
filter H r ( j)

x r (t )

T
In frequency domain:

X 0 ( j) = Ft x[n]h0 (t nT ) = x[n]H 0( j)e jnT


n =
n =


= x[n]e jnT H 0( j) = X (e jT ) H 0( j)

n =

2k

j
,
T

k =

1
2k

X 0 ( j ) = X a j
H 0 ( j )
T k =
T

1
(
)

=
X
j
Because
T

[The interpolation filter H 0 ( j) is used to remove the


replicas.]
If H 0 ( j) is not an ideal lowpass filter, we design a compensated
reconstruction filter,
H ( j )
~
H r ( j ) = r
, where H r ( j) is the ideal lowpass filter.
H 0 ( j )
(1) Zero-order hold

1, 0 < t < T
h0 (t ) =
0, otherwise

2sin(T / 2) jT / 2
e
Or , H 0 ( j) =

Thus, the compensated reconstruction filter is (Fig. 4.63)

T / 2
e jT / 2 , | |< / T

~
H r ( j) = sin(T / 2)

0,
| |> / T
Remark: A practical filter cannot achieve this approximation.
Overall system:

X a ( j )

H aa ( j)

H (e jT )

Anti-aliasing
reconst.

Processing

H 0 ( j )

~
H r ( j )

Ya ( j)

Zero-order-hold Compensated

~
Ya ( j) = H r ( j) H 0 ( j) H ( e jT ) H aa ( j) X a ( j)
(2) First-order hold
Better frequency response than zero-order-hold. Predict the next
x(t) using the current sample x(nT) and the slope between x(nT-T)
and x(nT).

(P&M)

x (t ) = x(nT ) +

x(nT ) x(nT T )
(t nT ), nT t < (n + 1)T
T

1 + t
0t T
T,

T t < 2T
h0 (t ) = 1 t
T,
0,
otherwise

2 sin(T / 2) j ( )

e
T
2

H 0 ( j) = T (1 + T )
2

and () =

2 1/ 2

T
+ tan 1 (T )
2

Você também pode gostar