Lecture10_ChangingSamplingRate.pptx

advertisement
Hossein Sameti
Department of Computer Engineering
Sharif University of Technology
Our focus
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
2
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
3
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
4
In practice, the sampling is performed by a S/H circuit.
Sample-and-hold (S/H)
 S/H is an analog circuit that tracks the analog signal during the
sample mode and holds it during the hold mode.
 The time needed for conversion should be less than the hold mode
duration.
 The sampling period T should be greater than the duration of
sample & hold mode

Copyright: NEC
5
The goal of the S/H is to continuously sample
the input and then hold the value constant as
long as it takes the A/D converter to digitally
represent (code) the samples.
 Thus, it allows the A/D converter to operate
more slowly than the time needed to acquire a
sample.
 S/H is of critical importance in digital
conversion of signals that change rapidly (i.e.
the signals with large bandwidth).

Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
6



Quantization: conversion of
continuous-valued signal into
discrete-valued.
Quantization effects: reducing
quantized levels results in signal
quality degradation.
Quantization is irreversible: results
in loss of information.
7
8
9
+
6V
+
G
0
0
0
0
0
0
0
1
4V
000
001
010
011
100
101
110
111
3V
2V
1V
C
B
A
-
F
0
0
0
0
0
0
1
1
+
E
0
0
0
0
0
1
1
1
-
D
0
0
0
0
1
1
1
1
+
C
0
0
0
1
1
1
1
1
D
-
B
0
0
1
1
1
1
1
1
+
A
0
1
1
1
1
1
1
1
Encoder Output
digital
output
-
Comparator Outputs
encoder
+
Converter
input
range (V)
<1
>1-2
>2-3
>3-4
>4-5
>5-6
>6-7
>7
E
-
5V
F
-

7V
G
-

Uses a reference and a comparator for each of the
discrete levels represented in the digital output
Number of comparators = number of quantization
levels
generally fast but expensive
+

input signal
10
Theoretically, the extreme decision levels are x1= - and xL+1= 
(i.e. cover the entire dynamic range of the signal). However ,in
practice, A/D converters can only handle a finite range R.

Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
11
During coding, A/D converters
assign a unique binary representation
to each quantization level.

 If we have L quantization levels, then we need to have L  2 B
where B is the number of bits needed for the binary representation.
 Quantization error:    eq (n)  
2
2
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
12
B

Each sample of the signal is quantized to one of the 2
amplitude levels, where B is the number of bits used to
represent each sample.

The quantized waveform is modeled as :
 e(n) represent the quantization error, Which we treat as an additive
noise.
~x (n)  x(n)  e(n)
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
13
◦ For small  , it is reasonable to assume that e[n] is a
random variable uniformly distributed from   / 2 to  / 2 .


  e[n] 
2
2
 Where the step size of the quantizer is
  2 B
1/ 


2

2
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
14
◦ If X m is the maximum amplitude of signal,
Xm
 B
2
◦ The mean square value of the quantization error is :
2
2
X
1
1
Δ
m
 e 2 (n)   
e 2 (n)de  e 3 (n) |Δ/2


Δ/2
 Δ/2 Δ
3Δ
12 2 2B  12
Δ/2
◦ Measured in dB, The mean square value of the noise is :
2
22 B
10 log 10  10 log 10
 6 B  10.8 dB.
12
12
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
15
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
16
Ideal C.T. to D.T. Converter:

s (t )    (t  nT )
n  
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
17
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
18
x(n)  DTFT
xc (t )  CTFT

X c ()  CTFT {xc (t )}   xc (t )e  jt dt


X ( )  DTFT {x(n)}   x(n)e  jn
n  


x s (t )  xc (t ) s (t )  xc (t )   (t  nT )
s (t )    (t  nT )
n  
n  

x s (t )   xc (nT ) (t  nT )
n  
Shifting property
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
19

x s (t )   xc (nT ) (t  nT )
CTFT
n  

X s ()   xc (nT )e  jTn
n  

X s ()   x(n)e  jTn
x(n)  xc (nT )
n  
(1)

X ( )  DTFT {x(n)}   x(n)e  jn
n  
(1), (2)
(2)
X s ()  X ( )  T  X (T )
(eq.3)
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
20
Frequency Domain:

s (t )    (t  nT )
n  
X s () 
1
X c () * S ()
2
2 
S () 
  (  k s )
T k  
1 
X s ( ) 
 X c (  k s )
T k  
s 
2
T
(Eq.4)
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
21
X s ()  X ( )  T  X (T )
1 
X s ( ) 
 X c (  k s )
T k  
(eq.3) and (eq.4)
s 
2
T
(eq.3)
(eq.4)
1 
  2k
X ( ) 
X
(
)
 c
T k  
T
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
22
X c ()
xc (t )
s (t )
-3T -2T –T
c
s ()
t
0 T 2T 3T t
xs (t )
2
T

 c
2
T
0

X s ()
-3T -2T –T
0 T 2T 3T t
2
T
c
 c
2
T
23
xs (t )
-3T -2T –T
X s ()
0 T 2T 3T t
2
T
c
To avoid aliasing:
fs 
2
 c  c
T
-2 –1
1
T
2
 2 c
T
c  2f c
x(n)
-3
 c
0 1
2
T

2

2
 c
T
f s  2 fc
X ( )
2
n
 2
 c
c
24
s   N   N
 s  2 N
fs  2 fN
25
s   N   N
 s  2 N
fs  2 fN
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
26
General configuration of digital processing systems

Anti-aliasing (i.e. pre-) filters are analog filters serving
two purposes:
◦ That the bandwidth of the signal to be sampled is limited to the
desired frequency range (thus no aliasing).
◦ Limiting the additive noise spectrum and other interference
corrupting the desired signal. Thus, it rejects the out-of-band
noise.
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
27
Changing the Sampling Rate
28
b
c d
a
-3
Downsample by
a factor of 2
x(n)
e
-2 –1
f
0 1
2
n
x d (n)
b
d
f
2
-1
0
1
n
• Downsample by a factor of N: Keep one sample, throw
away (N-1) samples
• Advantage?
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
29
xc (t )
-3T -2T –T
0 T 2T 3T
xc (t ) : A continuous-time signal
Suppose we now sample xc (t ) at two rates:
(1)
xc (t )
xc (t )
C/D
(2)
C/D
xd (n) 
x(n)  xc (nT )
T
xc ( nMT )
MT
•Q: Relationship between the DTFT’s of these two signals?
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
30
xc (t )
xc (t )
C/D
(1)
C/D
(2)
xd (n) 
x(n)  xc (nT )
xc ( nMT )
MT
T
1 
  2k
X ( )  DTFT {x(n)} 
)
 Xc(
T k 
T
1 
  2r
X d ( )  DTFT {xd (n)} 
)
 Xc(
MT r 
MT
• Change of variable:
r  i  kM
  k  
0  i  M 1
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
31
1 
  2k
X ( )  DTFT {x(n)} 
)
 Xc(
T k 
T
• Change of variable:
1 
  2r
X d ( )  DTFT {xd (n)} 
)
 Xc(
MT r 
MT
r  i  kM
  k  
0  i  M 1
k  0;

  r : 0  M 1
i:0
 M  1
k  1;

  r : M  2M  1
i:0
 M  1
k  2;

  r : 2 M  3M  1
i:0
 M  1
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
32
1 
  2k
X ( )  DTFT {x(n)} 
)
 Xc(
T k 
T
• Change of variable:
1 
  2r
X d ( )  DTFT {xd (n)} 
)
 Xc(
MT r 
MT
r  i  kM
  k  
0  i  M 1
1 M 1 1 
 2k 2i
X d ( ) 


)

 Xc(
M i 0 T k 
MT
T
MT
1 M 1 1 
  2i 2k
X d ( ) 
X
(

)


c
M i 0 T k 
MT
T
X(
  2i
M
)
33
1 
  2r
X d ( )  DTFT {xd (n)} 
)
 Xc(
MT r 
MT
1 M 1 1 
  2i 2k
X d ( ) 

)

 Xc(
M i 0 T k 
MT
T
X(
  2i
M
r  i  kM
  k  
0  i  M 1
)
1 M 1   2i
X d ( ) 
)
 X(
M i 0
M
If M=2,
1 1
  2i
X d ( )   X (
)
2 i 0
2
1

  2
X d ( )  [ X ( )  X (
)]
2
2
2
34
1


X d ( )  [ X ( )  X (   )]
2
2
2
X ( )
 2


2


2
2


X( )
2
 4


X(
2

4
  2
2

)
2 3
6

35
1


X d ( )  [ X ( )  X (   )]
2
2
2

X( )
2
 4

X(
2
4

  2
2

)
6
2
X d ( )
 4
2
2
4
6
•What could go wrong here?


36
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
37
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
38
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
39
• It is the process of increasing the sampling rate by an integer
factor.
• Application?
(1) xc (t )
C/D
x(n)  xc (nT )
C/D
xi (n)  xc (
T
(2)
xc (t )
nT
)
L
T/L
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
40
x(n)
b
d
b
a
-3
c d
-2 –1
f
e
0 1
f
2
xi (n)
n
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
41
X c ()
c
 c

X ( )
 2


2
X i ( )


 2


L


L
2
42
Question: How can we obtain xi (n) from x(n) ?
• Proposed Solution:
xe (n)
x(n)
 n
 x 
xe ( n )    L 
0
L
Low-pass filter with
gain L and cut-off
frequency L
xi (n)
n  0,  L,  2 L,...
Otherwise


Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
43
x(n)
b
d
b
a
-3
 n
 x 
xe ( n )    L 
0
c d
-2 –1
f
e
0 1
f
xi (n)
2
n
n  0,  L,  2 L,...
Otherwise


d
-3
-2 –1
f
0 1
xe (n)
2
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
n
44
•Q: Relationship between the DTFT’s of these three signals?
 n
 x 
xe ( n )    L 
0
n  0,  L,  2 L,...
Otherwise


xe (n)   x(k ) (n  kL)
k

  jn
X e ( )     x(k ) (n  kL)  e
nk




j

n

X e ( )   x(k )   (n  kL)e

k
n

Shifting property: e  jLk
45



j

n

X e ( )   x(k )   (n  kL)e

k
n

e  jLk
X e ( )  
k
On the other hand:

j

Lk
x ( k )e
(Eq.1)

X ( )  DTFT {x(n)}   x(k )e  jk
k  
(Eq.1) and (Eq.2)
(Eq.2)
X e ( )  X (L)
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
46
X ( )

 2


2
Xe( )



L


2

L
L
H ( )
In order to get X i ( )from X e ( )
we thus need an ideal low-pass
filter.
L


L


L

47
Xe( )



L


2

L
L
H ( )
L


L



L
Xi( )



L


L
2
48

The input and output plots of a factor-of-5/3
interpolator are given below
Input sequence
2
2
1
Amplitude
Amplitude
1
0
-1
-2
Output sequence
0
10
20
Time index n
30
0
-1
-2
0
10
20
30
Time index n
40
50
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
49

To implement a fractional change in the sampling
rate we need to employ a cascade of an up-sampler
and a down-sampler.
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
50
51
52



Reviewed sampling of continuous time signals and the
relationship between CTFT and DTFT.
Derived the effect of downsampling and upsampling of
signals in the frequency domain.
Adjusting the sampling rate is especially important
before applying pattern recognition algorithms, as it
can decrease the complexity of the subsequent signal
processing algorithms (by decreasing the length of the
signal of interest).
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi
53
Download