Transcript ppt
Digital Signal Processing
Prof. Nizamettin AYDIN
[email protected]
http://www.yildiz.edu.tr/~naydin
1
Digital Signal Processing
Lecture 8
Sampling & Aliasing
2
READING ASSIGNMENTS
• This Lecture:
– Chap 4, Sections 4-1 and 4-2
• Replaces Ch 4 in DSP First, pp. 83-94
• Other Reading:
– Recitation: Strobe Demo (Sect 4-3)
– Next Lecture: Chap. 4 Sects. 4-4 and 4-5
4
LECTURE OBJECTIVES
• SAMPLING can cause ALIASING
– Sampling Theorem
– Sampling Rate > 2(Highest Frequency)
• Spectrum for digital signals, x[n]
– Normalized Frequency
2f
ˆ Ts
2
fs
ALIASING
5
SYSTEMS Process Signals
x(t)
SYSTEM
y(t)
• PROCESSING GOALS:
– Change x(t) into y(t)
• For example, more BASS
– Improve x(t), e.g., image deblurring
– Extract Information from x(t)
6
System IMPLEMENTATION
• ANALOG/ELECTRONIC:
• Circuits: resistors, capacitors, op-amps
x(t)
ELECTRONICS
y(t)
• DIGITAL/MICROPROCESSOR
• Convert x(t) to numbers stored in memory
x(t)
A-to-D
x[n]
COMPUTER
y[n]
D-to-A
y(t)
7
SAMPLING x(t)
• SAMPLING PROCESS
• Convert x(t) to numbers x[n]
• “n” is an integer; x[n] is a sequence of values
• Think of “n” as the storage address in memory
• UNIFORM SAMPLING at t = nTs
• IDEAL: x[n] = x(nTs)
x(t)
C-to-D
x[n]
8
SAMPLING RATE, fs
• SAMPLING RATE (fs)
– fs =1/Ts
• NUMBER of SAMPLES PER SECOND
– Ts = 125 microsec fs = 8000 samples/sec
– UNITS ARE HERTZ: 8000 Hz
• UNIFORM SAMPLING at t = nTs = n/fs
– IDEAL: x[n] = x(nTs)=x(n/fs)
x(t)
C-to-D
x[n]=x(nTs)
9
f 100Hz
f s 2 kHz
f s 500Hz
10
SAMPLING THEOREM
• HOW OFTEN ?
– DEPENDS on FREQUENCY of SINUSOID
– ANSWERED by SHANNON/NYQUIST Theorem
– ALSO DEPENDS on “RECONSTRUCTION”
11
Reconstruction? Which One?
Given the samples, draw a sinusoid through the values
x[n ] cos( 0.4 n )
When n is an integer
cos(0.4 n) cos(2.4 n)
12
STORING DIGITAL SOUND
• x[n] is a SAMPLED SINUSOID
– A list of numbers stored in memory
• EXAMPLE: audio CD
• CD rate is 44,100 samples per second
– 16-bit samples
– Stereo uses 2 channels
• Number of bytes for 1 minute is
– 2 × (16/8) × 60 × 44100 = 10.584 Mbytes
13
DISCRETE-TIME SINUSOID
• Change x(t) into x[n]
DERIVATION
x(t ) A cos( t )
x[n] x(nTs ) A cos( nTs )
x[n] A cos((Ts )n )
x[n ] A cos(ˆ n )
ˆ
Ts f DEFINE DIGITAL FREQUENCY
s
14
DIGITAL FREQUENCY
•
̂
̂
VARIES from 0 to 2, as f varies from 0 to
the sampling frequency
• UNITS are radians, not rad/sec
– DIGITAL FREQUENCY is NORMALIZED
2f
ˆ Ts
fs
15
SPECTRUM (DIGITAL)
f
ˆ 2
fs
f s 1 kHz
1
2
X*
–0.2
1
2
X
2(0.1)
ˆ
x[n ] A cos( 2 (100)( n / 1000) )
16
SPECTRUM (DIGITAL) ???
f
ˆ 2
fs
f s 100 Hz
1
2
X*
?
–2
1
2
X
2(1)
x[n ] A cos( 2 (100)( n / 100) )
ˆ
x[n] is zero frequency???
17
The REST of the STORY
• Spectrum of x[n] has more than one line for
each complex exponential
– Called ALIASING
– MANY SPECTRAL LINES
• SPECTRUM is PERIODIC with period = 2
– Because
ˆ n ) A cos((
ˆ 2 )n )
A cos(
18
ALIASING DERIVATION
• Other Frequencies give the same
ˆ
x1 (t ) cos( 400 t ) sampled at f s 1000 Hz
n
x1[n] cos(400 1000
) cos(0.4 n)
x2 (t ) cos( 2400 t ) sampled at f s 1000 Hz
n
x2 [n] cos(2400 1000
) cos(2.4 n)
x2 [n] cos(2.4 n) cos(0.4 n 2 n) cos(0.4 n)
x2 [n] x1[n]
2400 400 2 (1000)
19
ALIASING DERIVATION–2
• Other Frequencies give the same
ˆ
If x(t) A cos(2( f f s )t )
ˆ n )
and we want : x[n] Acos(
n
t
fs
2 ( f f s ) 2 f 2 f s
then : ˆ
fs
fs
fs
2 f
2
ˆ Ts
fs
20
ALIASING CONCLUSIONS
• ADDING fs or 2fs or –fs to the FREQ of x(t)
gives exactly the same x[n]
– The samples, x[n] = x(n/ fs ) are EXACTLY THE
SAME VALUES
• GIVEN x[n], WE CAN’T DISTINGUISH fo
FROM (fo + fs ) or (fo + 2fs )
21
NORMALIZED FREQUENCY
• DIGITAL FREQUENCY
2f
ˆ Ts
2
fs
22
SPECTRUM for x[n]
• PLOT versus NORMALIZED FREQUENCY
• INCLUDE ALL SPECTRUM LINES
– ALIASES
• ADD MULTIPLES of 2
• SUBTRACT MULTIPLES of 2
– FOLDED ALIASES
• (to be discussed later)
• ALIASES of NEGATIVE FREQS
23
SPECTRUM (MORE LINES)
f
ˆ 2
fs
f s 1 kHz
1
2
X
–1.8
1
2
X*
–0.2
1
2
X
2(0.1)
1
2
X*
1.8
ˆ
x[n ] A cos( 2 (100)( n / 1000) )
24
SPECTRUM (ALIASING CASE)
f
ˆ 2
fs
f s 80 kHz
1
2
X*
–2.5
1
2
X
–1.5
1
2
X*
–0.5
1
2
X
0.5
1
2
X*
1.5
1
2
X
2.5
ˆ
x[n ] A cos( 2 (100)( n / 80) )
25
SAMPLING GUI (con2dis)
26
SPECTRUM (FOLDING CASE)
f
ˆ 2
fs
f s 125Hz
1
2
X*
–1.6
1
2
X
–0.4
1
2
X*
0.4
1
2
X
1.6
ˆ
x[n ] A cos( 2 (100)( n / 125) )
27