Professional Documents
Culture Documents
Sampling and Interpolation: Yao Wang Polytechnic University, Brooklyn, NY11201
Sampling and Interpolation: Yao Wang Polytechnic University, Brooklyn, NY11201
Outline
Basics of sampling and quantization
A/D and D/A converters
Sampling
Nyquist sampling theorem Aliasing due to undersampling:
temporal and frequency domain interpretation Sampling sinusoid signals
EE3414: Sampling
-0.5
A2D_plot.m
Yao Wang, 2006 EE3414: Sampling 3
Sampling
xc(t)
Sampling Period T
x[n] = xc(nT)
Quantization
x[ n]
Quantization Interval Q
x[ n] = x( nT ), < n <
[ n] = Q[ x(nT )] x
EE3414: Sampling
Q depends on the dynamic range of the signal amplitude and perceptual sensitivity
Q and the signal range D determine bits/sample R
2R=D/Q For speech: R = 8 bits; For music: R =16 bits;
EE3414: Sampling
Physical interpretation:
Must have at least two samples within each cycle!
EE3414: Sampling
Aliasing: The reconstructed sinusoid has a lower frequency than the original!
EE3414: Sampling
The spectrum of the sampled signal includes the original spectrum and its aliases (copies) shifted to k fs , k=+/- 1,2,3, The reconstructed signal from samples has the frequency components upto fs /2. When fs< 2fm , aliasing occur.
EE3414: Sampling
-fs -f0
-fs
f0 fs/2
fs-f0
fs
fs+f0
With aliasing f0<fs <2f0 (folding) fs -f0 <f0 Reconstructed signal: fs -f0 With aliasing fs <f0 (aliasing) f0-fs <f0 Reconstructed signal: fs -f0
Yao Wang, 2006
0 f0-fs
fs f0 fs+f0 9
EE3414: Sampling
EE3414: Sampling
10
Strobe Movie
From DSP First, Chapter 4, Demo on Strobe Movie
EE3414: Sampling
11
Fmax=1/Tmin Tmin Need at least two samples in this interval, in order not to miss the rise and fall pattern.
Yao Wang, 2006 EE3414: Sampling 12
Sampling period T
If fs < 2fm, aliasing will occur in sampled signal To prevent aliasing, pre-filter the continuous signal so that fm<fs/2 Ideal filter is a low-pass filter with cutoff frequency at fs/2 (corresponding to sync functions in time) Common practical pre-filter: averaging within one sampling interval
EE3414: Sampling
13
EE3414: Sampling
14
0.4 0.2 0 0 1 2 3 4 5 6 7 8 9 10
EE3414: Sampling
15
EE3414: Sampling
16
EE3414: Sampling
17
f - fs/2 fs/2
| f |< f s / 2 otherwise
T H r ( f )= 0
hr (t ) =
sin t / T t /T
xr (t ) = xs (t ) hr (t ) =
n =
x[n] hr (t nT ) =
n =
x[n]
sin[ (t nT ) / T ] (t nT ) / T
EE3414: Sampling
18
Down-sampling: reduce the sampling rate Up-Sampling: increase the sampling rate
EE3414: Sampling
19
Down-Sampling Illustration
1.2 1 0.8 0.6 0.4 0.2 0
To avoid aliasing of any high frequency content in the original signal, should smooth the original signal before down-sampling -Prefiltering
10
EE3414: Sampling
20
x [n]
EE3414: Sampling
21
Down-Sampling Example
Given a sequence of numbers, down-sample by a factor of 2,
Original sequence: 1,3,4,7,8,9,13,15 Without prefiltering, take every other sample:
1,4,8,13,
EE3414: Sampling
22
10
10
Missing samples need to be filled from neighboring available samples using interpolation filter
EE3414: Sampling
23
Up Sampling by a Factor of L
Insert L-1 samples between every two existing samples
T=T/L, fs=fs*L
The estimation of the missing samples from original samples is known as interpolation
zeropadding
Up-Sample Example
Given a sequence of numbers, up-sample by a factor of 2
Original sequence: 1,3,4,7,8,9,13,15 Zero-padding:
1,0,3,0,4,0,7,0,
EE3414: Sampling
25
Demonstration
Demonstrate the effect of down-sampling with different pre-filters, and up-sampling with different interpolation filters Compare both sound quality and frequency spectrum Matlab code (sampling_demo.m)
EE3414: Sampling
26
-20
EE3414: Sampling
27
EE3414: Sampling
28
y 0.4 0.2 -20 0 -0.2 -0.4 5000 10000 x41 0 0.2 -20 0 -40 -0.2 1000 2000 3000 z41 0 0.2 -20 0 -40 -0.2 5000 10000 15000 -60 0 -60 0 15000 -60 0 -40 0
psd-y
5000 psd-x41
5000 psd-z41
10000
-10
0 b41
10
0.2
0.8
0 -50
0.5 -100 0 -150 5000 10000 -10 0 10 0 0.2 0.4 0.6 0.8
EE3414: Sampling
29
EE3414: Sampling
30
MATLAB Code
Go through the code
EE3414: Sampling
31
Can illustrate samples on a waveform and observe whether the signal is under-sampled. Can plot the spectrum of a sampled signal
The sampled signal spectrum contains the original spectrum and its replicas (aliases) at kfs, k=+/- 1,2,. Can determine whether the sampled signal suffers from aliasing
Can show the aliasing phenomenon when sampling a sinusoid signal using both temporal and frequency domain interpretation
EE3414: Sampling
32
EE3414: Sampling
33
References
McClellan, Schafer and Yoder, DSP First, Chap. 4
Has good conceptual / graphical interpretation (copies provided, Sec. 4.3,4.5 not required)
Y. Wang, EL514 Lab Manual, Exp2: Voice and audio digitization and sampling rate conversion. Sec. 1,2. (copy provided) Oppenheim and Willsky, Signals and Systems, Chap. 7.
Optional reading (More depth in frequency domain interpretation)
EE3414: Sampling
34