Signal Processing First Lecture Slides
September 25, 2017 | Author: cfsenel | Category: N/A
Short Description
Download Signal Processing First Lecture Slides...
Description
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chapter 2, pp. 9-17
LECTURE #1 Sinusoids
Appendix A: Complex Numbers Appendix B: MATLAB Chapter 1: Introduction
4/3/2006
CONVERGING FIELDS Math
3
COURSE OBJECTIVE Students will be able to: Understand mathematical descriptions of signal processing algorithms and express those algorithms as computer implementations (MATLAB)
Physics
EE CmpE Computer Science
© 2003-2006, JH McClellan & RW Schafer
Applications
What are your objectives?
BIO 4/3/2006
© 2003-2006, JH McClellan & RW Schafer
4
4/3/2006
© 2003-2006, JH McClellan & RW Schafer
5
WHY USE DSP ?
Fourier Everywhere
Mathematical abstractions lead to generalization and discovery of new processing techniques
Telecommunications Sound & Music CDROM, Digital Video
Fourier Optics X-ray Crystallography Protein Structure & DNA
Computer implementations are flexible
Computerized Tomography Nuclear Magnetic Resonance: MRI Radioastronomy
Applications provide a physical context
Ref: Prestini, “The Evolution of Applied Harmonic Analysis” 4/3/2006
© 2003-2006, JH McClellan & RW Schafer
6
4/3/2006
© 2003-2006, JH McClellan & RW Schafer
LECTURE OBJECTIVES
TUNING FORK EXAMPLE
Write general formula for a “sinusoidal” waveform, or signal From the formula, plot the sinusoid versus time
What’s a signal?
CD-ROM demo “A” is at 440 Hertz (Hz) Waveform is a SINUSOIDAL SIGNAL Computer plot looks like a sine wave This should be the mathematical formula:
A cos(2π ( 440)t + ϕ )
It’s a function of time, x(t) in the mathematical sense 4/3/2006
© 2003-2006, JH McClellan & RW Schafer
7
8
4/3/2006
© 2003-2006, JH McClellan & RW Schafer
9
TUNING FORK A-440 Waveform T ≈ 8.15 − 5.85 = 2.3 ms
Break x(t) into its sinusoidal components
f = 1/ T
Called the FREQUENCY SPECTRUM
= 1000 / 2.3 ≈ 435 Hz
More complicated signal (BAT.WAV) Waveform x(t) is NOT a Sinusoid Theory will tell us x(t) is approximately a sum of sinusoids FOURIER ANALYSIS
Time (sec)
4/3/2006
SPEECH EXAMPLE
© 2003-2006, JH McClellan & RW Schafer
10
4/3/2006
© 2003-2006, JH McClellan & RW Schafer
Speech Signal: BAT
DIGITIZE the WAVEFORM
Nearly Periodic in Vowel Region
x[n] is a SAMPLED SINUSOID
Period is (Approximately) T = 0.0065 sec
11
A list of numbers stored in memory
Sample at 11,025 samples per second Called the SAMPLING RATE of the A/D Time between samples is 1/11025 = 90.7 microsec
Output via D/A hardware (at Fsamp) 4/3/2006
© 2003-2006, JH McClellan & RW Schafer
12
4/3/2006
© 2003-2006, JH McClellan & RW Schafer
13
STORING DIGITAL SOUND
SINES and COSINES
x[n] is a SAMPLED SINUSOID
Always use the COSINE FORM
A list of numbers stored in memory
A cos(2π ( 440)t + ϕ )
CD rate is 44,100 samples per second 16-bit samples Stereo uses 2 channels Number of bytes for 1 minute is
Sine is a special case:
sin(ω t ) = cos(ω t − π2 )
2 X (16/8) X 60 X 44100 = 10.584 Mbytes 4/3/2006
14
© 2003-2006, JH McClellan & RW Schafer
SINUSOIDAL SIGNAL
ω
Radians/sec Hertz (cycles/sec)
AMPLITUDE Magnitude
ω = (2π ) f
PERIOD (in sec)
T= 4/3/2006
1 2π = f ω
PHASE
© 2003-2006, JH McClellan & RW Schafer
© 2003-2006, JH McClellan & RW Schafer
15
EXAMPLE of SINUSOID
A cos(ω t + ϕ ) FREQUENCY
4/3/2006
Given the Formula
A
Make a plot
5 cos(0.3π t + 1.2π )
ϕ 16
4/3/2006
© 2003-2006, JH McClellan & RW Schafer
17
PLOTTING COSINE SIGNAL from the FORMULA
PLOT COSINE SIGNAL
5 cos(0.3π t + 1.2π )
5cos(0.3π t +12 . π)
Determine period:
Formula defines A, ω, and φ
T = 2π / ω = 2π / 0.3π = 20 / 3
A=5
Determine a peak location by solving
ω = 0.3π ϕ = 1.2π 4/3/2006
© 2003-2006, JH McClellan & RW Schafer
(ω t + ϕ ) = 0 ⇒ (0.3π t + 1.2π ) = 0 Zero crossing is T/4 before or after Positive & Negative peaks spaced by T/2 18
PLOT the SINUSOID
5 cos(0.3π t + 1.2π ) Use T=20/3 and the peak location at t=-4
← " 203 " →
4/3/2006
© 2003-2006, JH McClellan & RW Schafer
20
4/3/2006
© 2003-2006, JH McClellan & RW Schafer
19
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chapter 2, Sects. 2-3 to 2-5
LECTURE #2 Phase & Time-Shift Complex Exponentials
Appendix A: Complex Numbers Appendix B: MATLAB Next Lecture: finish Chap. 2, Section 2-6 to end
8/22/2003
8/22/2003
1
© 2003, JH McClellan & RW Schafer
LECTURE OBJECTIVES
SINUSOIDAL SIGNAL
A cos(ω t + ϕ ) FREQUENCY ω AMPLITUDE A Radians/sec
Define Sinusoid Formula from a plot Relate TIME-SHIFT to PHASE Introduce an ABSTRACTION: Complex Numbers represent Sinusoids Complex Exponential Signal
z (t ) = Xe 8/22/2003
© 2003, JH McClellan & RW Schafer
3
© 2003, JH McClellan & RW Schafer
or, Hertz (cycles/sec)
Magnitude
ω = ( 2π ) f
jωt
PERIOD (in sec)
T= 4
8/22/2003
1 2π = ω f
PHASE
© 2003, JH McClellan & RW Schafer
ϕ 5
PLOTTING COSINE SIGNAL from the FORMULA
ANSWER for the PLOT
5 cos(0.3π t + 1.2π )
5 cos(0.3π t + 1.2π )
Determine period:
Use T=20/3 and the peak location at t=-4
T = 2π / ω = 2π / 0.3π = 20 / 3 Determine a peak location by solving
← " 20 "→ 3
(ω t + ϕ ) = 0 Peak at t=-4 8/22/2003
© 2003, JH McClellan & RW Schafer
6
TIME-SHIFT
8/22/2003
© 2003, JH McClellan & RW Schafer
7
TIME-SHIFTED SINUSOID x (t + 4) = 5 cos(0.3π (t + 4)) = 5 cos(0.3π (t − ( −4))
In a mathematical formula we can replace t with t-tm
x (t − tm ) = A cos(ω (t − tm ))
Then the t=0 point moves to t=tm Peak value of cos(ω(t-tm)) is now at t=tm 8/22/2003
© 2003, JH McClellan & RW Schafer
8
8/22/2003
© 2003, JH McClellan & RW Schafer
9
PHASE TIME-SHIFT
SINUSOID from a PLOT
Equate the formulas:
Measure the period, T
A cos(ω (t − tm )) = A cos(ω t + ϕ ) − ω tm = ϕ
and we obtain: or,
tm = −0.00125 sec 8/22/2003
3 steps
Compute phase: φ = -ω tm
Measure height of positive peak: A 10
© 2003, JH McClellan & RW Schafer
ω=
2π T
=
8/22/2003
© 2003, JH McClellan & RW Schafer
11
SINE DRILL (MATLAB GUI)
(A, ω, φ) from a PLOT
.01sec 1 T = 10period = 100
Compute frequency: ω = 2π/T
Measure time of a peak: tm
ϕ tm = − ω
8/22/2003
Between peaks or zero crossings
2π 0.01
= 200π
ϕ = −ω tm = −(200π )(tm ) = 0.25π © 2003, JH McClellan & RW Schafer
12
8/22/2003
© 2003, JH McClellan & RW Schafer
13
PHASE is AMBIGUOUS
COMPLEX NUMBERS
The cosine signal is periodic
To solve: z2 = -1
Period is 2π
A cos(ω t + ϕ + 2π ) = A cos(ω t + ϕ )
Thus adding any multiple of 2π leaves x(t) unchanged
if tm = tm 2 = 8/22/2003
−ϕ
Complex number: z = x + j y y
z
, then
ω − (ϕ + 2π ) ω
=
−ϕ
ω
−
2π
ω
= tm − T
© 2003, JH McClellan & RW Schafer
© 2003, JH McClellan & RW Schafer
Cartesian coordinate system
x
14
8/22/2003
© 2003, JH McClellan & RW Schafer
15
COMPLEX ADDITION = VECTOR Addition
PLOT COMPLEX NUMBERS
8/22/2003
z=j Math and Physics use z = i
16
8/22/2003
z3 = z1 + z2 = (4 − j 3) + (2 + j5) = (4 + 2) + j ( −3 + 5) = 6 + j2
© 2003, JH McClellan & RW Schafer
17
*** POLAR FORM ***
POLAR RECTANGULAR
Vector Form
Relate (x,y) to (r,θ)
Length =1 Angle = θ
2
r =x +y
Common Values
θ=
j has angle of 0.5π −1 has angle of π − j has angle of 1.5π also, angle of −j could be −0.5π = 1.5π −2π because the PHASE is AMBIGUOUS 8/22/2003
© 2003, JH McClellan & RW Schafer
θ
()
y Tan −1 x
y x
x = r cosθ y = r sin θ
Need a notation for POLAR FORM 18
8/22/2003
© 2003, JH McClellan & RW Schafer
19
COMPLEX EXPONENTIAL
e jω t = cos(ω t ) + j sin(ω t )
Complex Exponential Real part is cosine Imaginary part is sine Magnitude is one
Interpret this as a Rotating Vector
e jθ = cos(θ ) + j sin(θ ) re jθ = r cos(θ ) + jr sin(θ ) © 2003, JH McClellan & RW Schafer
2
Most calculators do Polar-Rectangular
Euler’s FORMULA
8/22/2003
2
r
θ = ωt ω Angle changes vs. time ex: ω=20π rad/s Rotates 0.2π in 0.01 secs jθ
e
20
8/22/2003
= cos(θ ) + j sin(θ )
© 2003, JH McClellan & RW Schafer
21
cos = REAL PART Real Part of Euler’s General Sinusoid So,
REAL PART EXAMPLE
cos(ω t ) = ℜe{ e
jω t
}
Evaluate:
x (t ) = A cos(ω t + ϕ )
Answer:
A cos(ω t + ϕ ) = ℜe{ Ae j (ω t +ϕ ) }
{
COMPLEX AMPLITUDE General Sinusoid
{
x(t ) = A cos(ω t + ϕ ) = ℜe Ae jϕ e jωt
}
Complex AMPLITUDE = X
z (t ) = Xe jωt
X = Ae jϕ
Then, any Sinusoid = REAL PART of Xejωt
{
}
{
x(t ) = ℜe Xe jωt = ℜe Ae jϕ e jωt 8/22/2003
© 2003, JH McClellan & RW Schafer
{
}
}
}
}
= ℜe 3e − j 0.5π e jω t = 3 cos(ω t − 0.5π ) 22
© 2003, JH McClellan & RW Schafer
{
x (t ) = ℜe − 3 je jω t
x (t ) = ℜe ( −3 j )e jω t
= ℜe{ Ae jϕ e jω t } 8/22/2003
{
A cos(ω t + ϕ ) = ℜe Ae jϕ e jω t
}
24
8/22/2003
© 2003, JH McClellan & RW Schafer
23
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chapter 2, Section 2-6
LECTURE #3 Phasor Addition Theorem
1/12/2004
© 2003, JH McClellan & RW Schafer
Other Reading: Appendix A: Complex Numbers Appendix B: MATLAB Next Lecture: start Chapter 3
1/12/2004
1
© 2003, JH McClellan & RW Schafer
3
Z DRILL (Complex Arith)
LECTURE OBJECTIVES Phasors = Complex Amplitude Complex Numbers represent Sinusoids
z (t ) = Xe jωt = ( Ae jϕ )e jωt Develop the ABSTRACTION: Adding Sinusoids = Complex Addition
PHASOR ADDITION THEOREM 1/12/2004
© 2003, JH McClellan & RW Schafer
4
1/12/2004
© 2003, JH McClellan & RW Schafer
5
AVOID Trigonometry
Euler’s FORMULA
Algebra, even complex, is EASIER !!! Can you recall cos(θ1+θ2) ? Use: real part of ej(θ1+θ2) = cos(θ +θ ) 1
Complex Exponential Real part is cosine Imaginary part is sine Magnitude is one
2
e j (θ1 +θ 2 ) = e jθ1 e jθ 2 = (cosθ1 + j sin θ1 )(cosθ 2 + j sin θ 2 ) = (cosθ1 cosθ 2 − sin θ1 sin θ 2 ) + j (...) 1/12/2004
© 2003, JH McClellan & RW Schafer
6
Real & Imaginary Part Plots
e jθ = cos(θ ) + j sin(θ )
e jωt = cos(ω t ) + j sin(ω t ) 1/12/2004
© 2003, JH McClellan & RW Schafer
7
COMPLEX EXPONENTIAL
e jω t = cos(ω t ) + j sin(ω t ) Interpret this as a Rotating Vector PHASE DIFFERENCE
= π/2
θ = ωt ω Angle changes vs. time ex: ω=20π rad/s Rotates 0.2π in 0.01 secs
e jθ = cos(θ ) + j sin(θ ) 1/12/2004
© 2003, JH McClellan & RW Schafer
8
1/12/2004
© 2003, JH McClellan & RW Schafer
9
Rotating Phasor
Cos = REAL PART Real Part of Euler’s
See Demo on CD-ROM Chapter 2
General Sinusoid
cos(ω t) = ℜe{e jω t }
x(t) = Acos(ω t + ϕ ) So,
A cos(ω t + ϕ ) = ℜe{Ae j (ω t +ϕ ) } = ℜe{Ae jϕ e jω t }
1/12/2004
10
© 2003, JH McClellan & RW Schafer
1/12/2004
11
© 2003, JH McClellan & RW Schafer
COMPLEX AMPLITUDE
POP QUIZ: Complex Amp
General Sinusoid
Find the COMPLEX AMPLITUDE for:
x(t) = Acos(ω t + ϕ ) = ℜe{Ae jϕ e jω t } Sinusoid = REAL PART of (Aejφ)ejωt
x(t) = ℜe {Xe
jω t
x(t ) = 3 cos(77π t + 0.5π ) Use EULER’s FORMULA:
{ = ℜe{ 3e
x(t ) = ℜe 3e j ( 77π t +0.5π )
}= ℜe{z(t)}
Complex AMPLITUDE = X
z(t) = Xe 1/12/2004
jω t
© 2003, JH McClellan & RW Schafer
X = Ae
jϕ 12
1/12/2004
j 0.5π
X = 3e j 0.5π © 2003, JH McClellan & RW Schafer
e j 77π t
} } 13
WANT to ADD SINUSOIDS
ADD SINUSOIDS
ALL SINUSOIDS have SAME FREQUENCY HOW to GET {Amp,Phase} of RESULT ?
Sum Sinusoid has SAME Frequency
1/12/2004
1/12/2004
© 2003, JH McClellan & RW Schafer
14
PHASOR ADDITION RULE
© 2003, JH McClellan & RW Schafer
15
Phasor Addition Proof
Get the new complex amplitude by complex addition
1/12/2004
© 2003, JH McClellan & RW Schafer
16
1/12/2004
© 2003, JH McClellan & RW Schafer
17
POP QUIZ: Add Sinusoids
POP QUIZ (answer)
ADD THESE 2 SINUSOIDS:
COMPLEX ADDITION:
x1 (t ) = cos(77π t )
j 3 = 3e
x2 (t ) = 3 cos(77π t + 0.5π )
1e j 0 + 3e j 0.5π © 2003, JH McClellan & RW Schafer
j 0.5π
1 CONVERT back to cosine form:
COMPLEX ADDITION:
1/12/2004
1 + j 3 = 2e jπ / 3
x3 (t ) = 2 cos(77π t + π3 ) 18
ADD SINUSOIDS EXAMPLE
1/12/2004
© 2003, JH McClellan & RW Schafer
19
Convert Time-Shift to Phase
x1 (t ) tm1
Measure peak times: tm1=-0.0194, tm2=-0.0556, tm3=-0.0394
Convert to phase (T=0.1)
x2 (t )
φ1=-ω ωtm1 = -2π π(tm1 /T) = 70π/180, φ2= 200π/180
tm2
Amplitudes
x3 (t ) = x1 (t ) + x2 (t )
A1=1.7, A2=1.9, A3=1.532
tm3 1/12/2004
© 2003, JH McClellan & RW Schafer
20
1/12/2004
© 2003, JH McClellan & RW Schafer
21
Phasor Add: Numerical
ADD SINUSOIDS
Convert Polar to Cartesian X1 = 0.5814 + j1.597 X2 = -1.785 - j0.6498 sum = X3 = -1.204 + j0.9476
X1
Convert back to Polar
VECTOR (PHASOR) ADD
X3 = 1.532 at angle 141.79π/180 This is the sum 1/12/2004
© 2003, JH McClellan & RW Schafer
22
1/12/2004
X3
X2
© 2003, JH McClellan & RW Schafer
23
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chapter 3, Section 3-1
Lecture 4 Spectrum Representation
Other Reading: Appendix A: Complex Numbers Next Lecture: Ch 3, Sects 3-2, 3-3, 3-7 & 3-8
8/31/2003
© 2003, JH McClellan & RW Schafer
8/31/2003
1
3
© 2003, JH McClellan & RW Schafer
LECTURE OBJECTIVES
FREQUENCY DIAGRAM
Sinusoids with DIFFERENT Frequencies
Plot Complex Amplitude vs. Freq
SYNTHESIZE by Adding Sinusoids
N
x (t ) = ∑ Ak cos(2π f k t + ϕ k )
4e − jπ / 2
k =1
SPECTRUM Representation
–250
7e
jπ / 3
–100
10
0
7e − jπ / 3
100
Graphical Form shows DIFFERENT Freqs 8/31/2003
© 2003, JH McClellan & RW Schafer
4
8/31/2003
© 2003, JH McClellan & RW Schafer
4e jπ / 2 250
f (in Hz)
5
Frequency is the vertical axis
Another FREQ. Diagram
8/31/2003
MOTIVATION
A-440
Synthesize Complicated Signals Musical Notes Piano uses 3 strings for many notes Chords: play several notes simultaneously
Human Speech Vowels have dominant frequencies Application: computer generated speech
Can all signals be generated this way? Sum of sinusoids?
Time is the horizontal axis
6
© 2003, JH McClellan & RW Schafer
Fur Elise WAVEFORM
© 2003, JH McClellan & RW Schafer
© 2003, JH McClellan & RW Schafer
7
Speech Signal: BAT Nearly Periodic in Vowel Region
Beat Notes
8/31/2003
8/31/2003
Period is (Approximately) T = 0.0065 sec
8
8/31/2003
© 2003, JH McClellan & RW Schafer
9
Euler’s Formula Reversed
INVERSE Euler’s Formula
Solve for cosine (or sine)
Solve for cosine (or sine)
e jω t = cos(ω t ) + j sin(ω t )
e
− jω t
cos(ω t ) = 12 (e jω t + e − jω t )
= cos( −ω t ) + j sin( −ω t )
e − jω t = cos(ω t ) − j sin(ω t ) e jω t + e − jω t = 2 cos(ω t )
sin(ω t ) =
cos(ω t ) = 12 (e jω t + e − jω t ) 8/31/2003
10
© 2003, JH McClellan & RW Schafer
8/31/2003
1 2j
(e jω t − e − jω t )
© 2003, JH McClellan & RW Schafer
SPECTRUM Interpretation
NEGATIVE FREQUENCY
Cosine = sum of 2 complex exponentials:
Is negative frequency real? Doppler Radar provides an example
A cos(7t ) =
A e j 7t 2
+ 2A e − j 7t
Police radar measures speed by using the Doppler shift principle Let’s assume 400Hz ÅÆ60 mph +400Hz means towards the radar -400Hz means away (opposite direction) Think of a train whistle
One has a positive frequency The other has negative freq. Amplitude of each is half as big
8/31/2003
© 2003, JH McClellan & RW Schafer
11
12
8/31/2003
© 2003, JH McClellan & RW Schafer
13
SPECTRUM of SINE
GRAPHICAL SPECTRUM EXAMPLE of SINE
Sine = sum of 2 complex exponentials: A sin(7t ) = 2Aj e j 7t − 2Aj e − j 7t = 12 Ae − j 0.5π e j 7t + 12 Ae j 0.5π e − j 7t −1 = j Positive freq. has phase = -0.5π Negative freq. has phase = +0.5π
8/31/2003
A sin(7t ) =
1 2
Ae − j 0.5π e j 7t + 12 Ae j 0.5π e − j 7t
( 12 A)e − j 0.5π
( 12 A)e j 0.5π
j = e j 0.5π -7
7
8/31/2003
15
© 2003, JH McClellan & RW Schafer
SPECTRUM ---> SINUSOID
Gather (A,ω,φ ω,φ) ω,φ information
Add the spectrum components:
Frequencies:
4e
− jπ / 2
–250
7e
jπ / 3
–100
10 7e
0
− jπ / 3
100
4e jπ / 2 250
© 2003, JH McClellan & RW Schafer
-250 Hz -100 Hz 0 Hz 100 Hz 250 Hz
Amplitude & Phase
4 7 10 7 4
-π/2 +π/3 0 -π/3 +π/2
Note the conjugate phase
f (in Hz)
DC is another name for zero-freq component DC component always has φ=0 or π (for real x(t) )
What is the formula for the signal x(t)? 8/31/2003
ω
AMPLITUDE, PHASE & FREQUENCY are shown 14
© 2003, JH McClellan & RW Schafer
0
16
8/31/2003
© 2003, JH McClellan & RW Schafer
17
Add Spectrum Components-1 Frequencies:
Amplitude & Phase
-250 Hz -100 Hz 0 Hz 100 Hz 250 Hz
-π π/2 +π π/3 0 -π π/3 +π π/2
4 7 10 7 4
4e − jπ / 2
7e − jπ / 3e j 2π (100)t + 7e jπ / 3e − j 2π (100)t 4e jπ / 2e j 2π ( 250)t + 4e − jπ / 2e − j 2π ( 250)t 18
© 2003, JH McClellan & RW Schafer
Simplify Components
7e
e
+ 7e
jπ / 3 − j 2π (100) t
e
4e jπ / 2e j 2π ( 250)t + 4e − jπ / 2e − j 2π ( 250)t A cos(ω t + ϕ ) = 12 Ae jϕ e jω t + 12 Ae − jϕ e − jω t © 2003, JH McClellan & RW Schafer
10
–100
7e − jπ / 3
0
100
4e jπ / 2 250
f (in Hz)
x (t ) = 10 + 7e − jπ / 3e j 2π (100)t + 7e jπ / 3e − j 2π (100)t 8/31/2003
4e jπ / 2e j 2π ( 250)t + 4e − jπ / 2e − j 2π ( 250)t © 2003, JH McClellan & RW Schafer
19
x (t ) = 10 + 14 cos(2π (100)t − π / 3) + 8 cos(2π ( 250)t + π / 2) So, we get the general form:
N
Use Euler’s Formula to get REAL sinusoids:
8/31/2003
jπ / 3
FINAL ANSWER
x (t ) = 10 + − jπ / 3 j 2π (100) t
7e
–250
x (t ) = 10 +
8/31/2003
Add Spectrum Components-2
20
x (t ) = A0 + ∑ Ak cos(2π f k t + ϕ k ) k =1
8/31/2003
© 2003, JH McClellan & RW Schafer
21
Summary: GENERAL FORM
Example: Synthetic Vowel
N
x (t ) = A0 + ∑ Ak cos(2π f k t + ϕ k ) k =1 N
{
x (t ) = X 0 + ∑ ℜe X k e j 2π f k t
ℜe{z} = 12 z +
k =1 1 z∗ 2 N
x (t ) = X 0 + ∑
{
k =1
8/31/2003
1 2
}
Sum of 5 Frequency Components
X k = Ak e jϕ k Frequency = f k
X k e j 2π f k t + 12 X k∗e − j 2π f k t
© 2003, JH McClellan & RW Schafer
} 22
8/31/2003
23
© 2003, JH McClellan & RW Schafer
SPECTRUM of VOWEL (Polar Format)
SPECTRUM of VOWEL Note: Spectrum has 0.5Xk (except XDC) Conjugates in negative frequency
0.5Ak
φk 8/31/2003
© 2003, JH McClellan & RW Schafer
24
8/31/2003
© 2003, JH McClellan & RW Schafer
25
Vowel Waveform (sum of all 5 components)
8/31/2003
© 2003, JH McClellan & RW Schafer
26
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chapter 3, Sections 3-2 and 3-3 Chapter 3, Sections 3-7 and 3-8
Lecture 5 Periodic Signals, Harmonics & Time-Varying Sinusoids
Next Lecture:
Fourier Series ANALYSIS Sections 3-4, 3-5 and 3-6
1/28/2005
© 2003, JH McClellan & RW Schafer
1/28/2005
1
Problem Solving Skills Math Formula
Recorded Signals
1/28/2005
Signals with HARMONIC Frequencies Add Sinusoids with fk = kf0 N
S(t) versus t Spectrum
x (t ) = A0 + ∑ Ak cos(2π kf 0t + ϕ k ) k =1
MATLAB
Speech Music No simple formula
© 2003, JH McClellan & RW Schafer
3
LECTURE OBJECTIVES
Plot & Sketches
Sum of Cosines Amp, Freq, Phase
© 2003, JH McClellan & RW Schafer
Numerical Computation Plotting list of numbers
FREQUENCY can change vs. TIME Chirps: 2
x(t) = cos(α t )
Introduce Spectrogram Visualization (specgram.m) (plotspec.m) 4
1/28/2005
© 2003, JH McClellan & RW Schafer
5
SPECTRUM DIAGRAM
SPECTRUM for PERIODIC ?
Recall Complex Amplitude vs. Freq
Nearly Periodic in the Vowel Region
1 2
X k∗
4e
− jπ / 2
7e
jπ / 3
10 7e
X k = Ak e
–250
–100
1 2
− jπ / 3
4e jπ / 2
jϕ k
0
100
250
x (t ) = 10 + 14 cos(2π (100)t − π / 3) + 8 cos(2π ( 250)t + π / 2) 1/28/2005
Period is (Approximately) T = 0.0065 sec
X k = ak
f (in Hz)
© 2003, JH McClellan & RW Schafer
6
PERIODIC SIGNALS
x (t ) = e jω t x (t + T ) = x (t ) ?
x (t ) = x (t + T )
Example:
x (t ) = cos2 (3t )
T =? T=
2π 3
T = π3
Speech can be “quasi-periodic”
1/28/2005
© 2003, JH McClellan & RW Schafer
© 2003, JH McClellan & RW Schafer
7
Period of Complex Exponential
Repeat every T secs Definition
1/28/2005
8
Definition: Period is T
e jω ( t +T ) = e jω t e j 2π k = 1 ⇒ e jωT = 1 ⇒ ωT = 2π k 2π k ⎛ 2π ⎞ k = integer ω= =⎜ ⎟k = ω 0k 1/28/2005
T
⎝ T ⎠
© 2003, JH McClellan & RW Schafer
9
Harmonic Signal Spectrum
Define FUNDAMENTAL FREQ
Periodic signal can only have : f k = k f 0
N
x (t ) = A0 + ∑ Ak cos(2π kf 0t + ϕ k ) k =1
N
x (t ) = A0 + ∑ Ak cos(2π kf 0t + ϕ k ) k =1
X k = Ak e jϕ k N
x (t ) = X 0 + ∑ k =1
1/28/2005
{
1 2
f0 =
1 T
X k e j 2π kf 0t + 12 X k∗e − j 2π kf 0t
© 2003, JH McClellan & RW Schafer
}
10
Harmonic Signal (3 Freqs)
(ω0 = 2π f 0 )
fk = k f0
f0 =
1 T0
f 0 = fundamental Frequency (largest) T0 = fundamental Period (shortest) 1/28/2005
© 2003, JH McClellan & RW Schafer
11
POP QUIZ: FUNDAMENTAL Here’s another spectrum:
3rd
4e − jπ / 2
5th
–250
What is the fundamental frequency?
7e
jπ / 3
–100
10
7e − jπ / 3
0
100
10 Hz
4e jπ / 2 250
f (in Hz)
What is the fundamental frequency?
100 Hz ? 1/28/2005
© 2003, JH McClellan & RW Schafer
12
1/28/2005
50 Hz ? © 2003, JH McClellan & RW Schafer
13
IRRATIONAL SPECTRUM
Harmonic Signal (3 Freqs) T=0.1
SPECIAL RELATIONSHIP to get a PERIODIC SIGNAL
1/28/2005
© 2003, JH McClellan & RW Schafer
14
NON-Harmonic Signal
1/28/2005
© 2003, JH McClellan & RW Schafer
15
FREQUENCY ANALYSIS Now, a much HARDER problem Given a recording of a song, have the computer write the music
Can a machine extract frequencies? Yes, if we COMPUTE the spectrum for x(t) During short intervals 1/28/2005
© 2003, JH McClellan & RW Schafer
NOT PERIODIC 16
1/28/2005
© 2003, JH McClellan & RW Schafer
17
Frequency is the vertical axis
Time-Varying FREQUENCIES Diagram
1/28/2005
SIMPLE TEST SIGNAL C-major SCALE: stepped frequencies
A-440
Frequency is constant for each note
IDEAL
Time is the horizontal axis © 2003, JH McClellan & RW Schafer
18
1/28/2005
© 2003, JH McClellan & RW Schafer
R-rated: ADULTS ONLY
SPECTROGRAM EXAMPLE
SPECTROGRAM Tool
Two Constant Frequencies: Beats
19
MATLAB function is specgram.m SP-First has plotspec.m & spectgr.m
ANALYSIS program Takes x(t) as input & Produces spectrum values Xk Breaks x(t) into SHORT TIME SEGMENTS
cos(2π (660)t ) sin(2π (12)t )
Then uses the FFT (Fast Fourier Transform) 1/28/2005
© 2003, JH McClellan & RW Schafer
20
1/28/2005
© 2003, JH McClellan & RW Schafer
21
AM Radio Signal
SPECTRUM of AM (Beat)
Same as BEAT Notes
4 complex exponentials in AM:
1 2
(e
1 4j
cos(2π (660)t ) sin(2π (12)t )
j 2π ( 660 ) t
(e 1 2
− e − j 2π (12 ) t
)
− e − j 2π ( 672 ) t − e j 2π ( 648) t + e − j 2π ( 648) t
)
+ e − j 2π ( 660) t
j 2π ( 672 ) t
cos(2π (672)t −
1/28/2005
) (e 1 2j
j 2π (12 ) t
π ) + 1 cos( 2π (648)t 2
2
+
1 4
e jπ / 2
–672
e − jπ / 2
1 4
0
–648
e jπ / 2
648
1 4
e − jπ / 2
672
f (in Hz)
What is the fundamental frequency?
π) 2
© 2003, JH McClellan & RW Schafer
1 4
648 Hz ? 22
STEPPED FREQUENCIES
1/28/2005
24 Hz ? © 2003, JH McClellan & RW Schafer
23
SPECTROGRAM of C-Scale
C-major SCALE: successive sinusoids
Sinusoids ONLY
Frequency is constant for each note
From SPECGRAM ANALYSIS PROGRAM
IDEAL
ARTIFACTS at Transitions 1/28/2005
© 2003, JH McClellan & RW Schafer
24
1/28/2005
© 2003, JH McClellan & RW Schafer
25
Spectrogram of LAB SONG
Time-Varying Frequency Frequency can change vs. time
Sinusoids ONLY Analysis Frame = 40ms
Continuously, not stepped
FREQUENCY MODULATION (FM)
ARTIFACTS at Transitions
x (t ) = cos(2π f c t + v (t )) VOICE
CHIRP SIGNALS Linear Frequency Modulation (LFM) 1/28/2005
© 2003, JH McClellan & RW Schafer
26
New Signal: Linear FM Called Chirp Signals (LFM) Quadratic phase
1/28/2005
Definition
x (t ) = A cos(ψ (t )) d ψ (t ) ⇒ ωi (t ) = dt
QUADRATIC
Derivative of the “Angle”
For Sinusoid:
x (t ) = A cos(2π f 0t + ϕ ) ψ (t ) = 2π f 0t + ϕ
Freq will change LINEARLY vs. time Example of Frequency Modulation (FM) Define “instantaneous frequency” © 2003, JH McClellan & RW Schafer
27
INSTANTANEOUS FREQ
x (t ) = A cos(α t 2 + 2π f 0 t + ϕ )
1/28/2005
© 2003, JH McClellan & RW Schafer
⇒ ωi ( t ) = 28
1/28/2005
d ψ (t ) dt
Makes sense
= 2π f 0
© 2003, JH McClellan & RW Schafer
29
INSTANTANEOUS FREQ of the Chirp
CHIRP SPECTROGRAM
Chirp Signals have Quadratic phase Freq will change LINEARLY vs. time
x (t ) = A cos(α t 2 + β t + ϕ ) ⇒ ψ (t ) = α t 2 + β t + ϕ ⇒ ωi ( t ) = 1/28/2005
d ψ (t ) dt
= 2α t + β
© 2003, JH McClellan & RW Schafer
30
CHIRP WAVEFORM
1/28/2005
© 2003, JH McClellan & RW Schafer
31
OTHER CHIRPS ψ(t) can be anything:
x (t ) = A cos(α cos( β t ) + ϕ ) ⇒ ωi (t ) = dtd ψ (t ) = −αβ sin( β t ) ψ(t) could be speech or music: FM radio broadcast 1/28/2005
© 2003, JH McClellan & RW Schafer
32
1/28/2005
© 2003, JH McClellan & RW Schafer
33
SINE-WAVE FREQUENCY MODULATION (FM)
Look at CD-ROM Demos in Ch 3 1/28/2005
© 2003, JH McClellan & RW Schafer
34
READING ASSIGNMENTS
Signal Processing First
This Lecture: Fourier Series in Ch 3, Sects 3-4, 3-5 & 3-6 Replaces pp. 62-66 in Ch 3 in DSP First Notation: ak for Fourier Series
Lecture 6 Fourier Series Coefficients
Other Reading: Next Lecture: More Fourier Series
9/8/2003
9/8/2003
1
© 2003, JH McClellan & RW Schafer
© 2003, JH McClellan & RW Schafer
LECTURE OBJECTIVES
HISTORY
Work with the Fourier Series Integral
Jean Baptiste Joseph Fourier
ak =
1 T0
∫
T0
x (t )e
− j ( 2π k / T0 ) t
1807 thesis (memoir)
dt
On the Propagation of Heat in Solid Bodies
Heat ! Napoleonic era
0
ANALYSIS via Fourier Series For PERIODIC signals:
3
x(t+T0) = x(t)
http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Fourier.html
Later: spectrum from the Fourier Series 9/8/2003
© 2003, JH McClellan & RW Schafer
4
9/8/2003
© 2003, JH McClellan & RW Schafer
5
SPECTRUM DIAGRAM Recall Complex Amplitude vs. Freq 1 2
X k*
4e − jπ / 2 –250
7e
10
jπ / 3
7e
X k = Ake –100
N
jϕ k
0
{
− jπ / 3
1 2
X k = ak
4e jπ / 2
100
250
* x (t ) = Xa0 + ∑ {12 aXkk e j 2π f t + 12 aXkk∗ e − j 2π f t k =1
9/8/2003
© 2003, JH McClellan & RW Schafer
6
x (t ) =
∑ ak e
j 2π k f 0 t
7
∞
j 2π k f 0 t a e ∑ k
k = −∞
ak = 12 X k = 12 Ak e jϕ k
PERIOD/FREQUENCY of COMPLEX EXPONENTIAL:
9/8/2003
}
© 2003, JH McClellan & RW Schafer
x (t ) =
k = −∞
2π 2π ( f 0 ) = ω0 = T0
k
Fourier Series Synthesis
Harmonic Signal ∞
9/8/2003
k
f (in Hz)
N
1 or T0 = f0
© 2003, JH McClellan & RW Schafer
x (t ) = A0 + ∑ Ak cos(2π kf 0t + ϕ k ) k =1
X k = Ak e 8
9/8/2003
jϕ k
© 2003, JH McClellan & RW Schafer
COMPLEX AMPLITUDE 9
Harmonic Signal (3 Freqs)
SYNTHESIS vs. ANALYSIS
a1 a3
SYNTHESIS
a5
ANALYSIS
Easy Given (ωk,Ak,φk) create x(t)
T = 0.1
Synthesis can be HARD
Hard Given x(t), extract (ω ωk,Ak,φk) How many? Need algorithm for computer
Synthesize Speech so that it sounds good
9/8/2003
10
© 2003, JH McClellan & RW Schafer
9/8/2003
11
© 2003, JH McClellan & RW Schafer
STRATEGY: x(t) Æ ak
INTEGRAL Property of exp(j)
ANALYSIS
INTEGRATE over ONE PERIOD
Get representation from the signal Works for PERIODIC Signals
T0 − j ( 2π / T0 ) mt = e − j ( 2π / T0 ) mt e dt ∫ − j 2π m 0 0 T0 = (e − j 2π m − 1) − j 2π m
Fourier Series Answer is: an INTEGRAL over one period
ak = 9/8/2003
1 T0
∫
T0
x (t )e
− jω 0k t
T0
dt
− j ( 2π / T0 ) mt dt = 0 ∫e 0
0
© 2003, JH McClellan & RW Schafer
T0
T0
12
9/8/2003
m≠0
© 2003, JH McClellan & RW Schafer
ω0 =
2π T0 13
ORTHOGONALITY of exp(j)
Isolate One FS Coefficient
PRODUCT of exp(+j ) and exp(-j )
x (t ) =
T 0 k ≠ 1 0 j ( 2π / T0 ) t − j ( 2π / T0 ) kt e e dt = ∫ T0 0 1 k = T
1 0 j ( 2π / T0 )( e ∫ T0 0 9/8/2003
−k ) t
1 T0
dt 14
∫ x (t )e
© 2003, JH McClellan & RW Schafer
− j ( 2π / T0 ) t
0
T0 1 T0
∫ x (t )e
T0
dt =
1 T0
∞ ak e j ( 2π / T0 ) k t e − j ( 2π / T0 ) t dt ∫ k∑ = −∞ 0
T0 j ( 2π / T ) k t − j ( 2π / T ) t 0 0 dt = ∑ ak T1 ∫ e e dt = a 0 k = −∞ 0 Integral is zero ∞
− j ( 2π / T0 ) k t
dt
except for k =
0
9/8/2003
15
© 2003, JH McClellan & RW Schafer
FS for a SQUARE WAVE
{ak}
T
1 0 ak = ∫ x (t )e − j ( 2π / T0 ) kt dt T0 0
(k ≠ 0)
.02
.02 1 − j ( 2π / .04 ) kt − j ( 2π / .04 ) kt 1 ak = 1e dt = .04( − j 2π k / .04 ) e 0 .04 ∫0
1
.02
− j ( 2π / T0 ) t
0
⇒ ak =
x(t)
9/8/2003
∫ x (t )e
T0 1 T0
1 0 ≤ t < 12 T0 x (t ) = 0 12 T0 ≤ t < T0 for T0 = 0.04 sec.
.01
0
k = −∞
SQUARE WAVE EXAMPLE
0
∑ ak e j ( 2π / T )k t
T0
© 2003, JH McClellan & RW Schafer
–.02
∞
0.04
1 1 − ( −1)k − j (π ) k (e = − 1) = ( − j 2π k ) j 2π k
t 16
9/8/2003
© 2003, JH McClellan & RW Schafer
17
DC Coefficient: a0
Fourier Coefficients ak
T
1 0 ak = ∫ x (t )e − j ( 2π / T0 ) kt dt T0 0
ak is a function of k
(k = 0)
Complex Amplitude for k-th Harmonic This one doesn’t depend on the period, T0
T
1 0 1 a0 = ∫ x (t )dt = ( Area ) T0 0 T0
1 jπ k k 1 − ( −1) ak = = 0 j 2π k 12
.02
a0 = 9/8/2003
1 1 1 dt = (.02 − 0) = .04 ∫0 .04
1 2
© 2003, JH McClellan & RW Schafer
18
Spectrum from Fourier Series ω0 = 2π /(0.04) = 2π (25)
− j πk ak = 0 12
k = ±1,±3,… k = ±2,±4,… k =0
9/8/2003
20
k =0 19
Fourier Series Integral HOW do you determine ak from x(t) ? T0
ak =
a0 = © 2003, JH McClellan & RW Schafer
k = ±2,±4,…
© 2003, JH McClellan & RW Schafer
1 T0
− j ( 2π / T0 ) k t x ( t ) e dt ∫ 0
T0
9/8/2003
k = ±1,±3,…
9/8/2003
1 T0
Fundamental Frequency f 0 = 1 / T0
∫ x(t )dt
a−k = ak*
when x (t ) is real
(DC component)
0
© 2003, JH McClellan & RW Schafer
21
READING ASSIGNMENTS
Signal Processing First
This Lecture: Fourier Series in Ch 3, Sects 3-4, 3-5 & 3-6 Replaces pp. 62-66 in Ch 3 in DSP First Notation: ak for Fourier Series
Lecture 7 Fourier Series & Spectrum
Other Reading: Next Lecture: Sampling
9/13/2006
EE-2025
Spring-2005
3
jMc
LECTURE OBJECTIVES
SPECTRUM DIAGRAM
ANALYSIS via Fourier Series
Recall Complex Amplitude vs. Freq
For PERIODIC signals:
ak =
1 T0
∫
ak∗
x(t+T0) = x(t)
T0
x (t )e
− j ( 2π k / T0 ) t
4e − jπ / 2
dt
7e jπ / 3
10
7e − jπ / 3
a0
ak = 12 Ak e jϕ k
4e jπ / 2
0
–250
SPECTRUM from Fourier Series
–100
N
0
100
{
250
x (t ) = a0 + ∑ ak e j 2π f k t + ak∗ e − j 2π f k t
ak is Complex Amplitude for k-th Harmonic
f (in Hz)
}
k =1
9/13/2006
EE-2025
Spring-2005
jMc
4
9/13/2006
EE-2025
Spring-2005
jMc
5
Harmonic Signal
Example
x (t ) = sin 3 (3π t )
∞
x (t ) =
∑ ak e j 2π k f t 0
k = −∞
PERIOD/FREQUENCY of COMPLEX EXPONENTIAL:
2π ( ) 2π f 0 = ω0 = T0
9/13/2006
EE-2025
Example
Spring-2005
1 or T0 = f0
⎛ j⎞ ⎛ − 3 j ⎞ j 3π t ⎛ 3 j ⎞ − j 3π t ⎛ − j ⎞ − j 9π t x (t ) = ⎜ ⎟e j 9π t + ⎜ +⎜ + ⎜ ⎟e ⎟e ⎟e ⎝ 8 ⎠ ⎝ 8 ⎠ ⎝8⎠ ⎝ 8 ⎠ 6
jMc
x (t ) = sin 3 (3π t )
EE-2025
Spring-2005
jMc
7
STRATEGY: x(t) Æ ak
⎛ j⎞ ⎛ − 3 j ⎞ j 3π t ⎛ 3 j ⎞ − j 3π t ⎛ − j ⎞ − j 9π t x (t ) = ⎜ ⎟e j 9π t + ⎜ +⎜ + ⎜ ⎟e ⎟e ⎟e ⎝8⎠ ⎝ 8 ⎠ ⎝ 8 ⎠ ⎝ 8 ⎠ In this case, analysis just requires picking off the coefficients.
9/13/2006
ak
ANALYSIS Get representation from the signal Works for PERIODIC Signals
Fourier Series Answer is: an INTEGRAL over one period
k = −3 9/13/2006
k =1
k = −1
EE-2025
Spring-2005
jMc
ak =
k =3 8
9/13/2006
1 T0
∫
T0
x (t )e − jω0k t dt
0
EE-2025
Spring-2005
jMc
9
FS: Rectified Sine Wave {ak} T0
1 ak = T0 ak =
∫ x (t )e
− j ( 2π / T0 ) kt
0
Half-Wave Rectified Sine
T0 / 2
∫
1 T0
( k ≠ ±1)
dt
sin( 2Tπ 0
t) e
− j ( 2π / T0 ) kt
=
∫
1 T0
j ( 2π / T0 ) t
e
0
=
T0 / 2 1 j 2T0
∫
e
−e 2j
− j ( 2π / T0 ) t
− j ( 2π / T0 )( k −1) t
dt −
e − j ( 2π / T0 ) kt dt
=
e − j ( 2π / T0 )( k +1) t dt
∫
T0 / 2
−
j 2T0 ( − j ( 2π / T0 )( k −1))
9/13/2006
e − j ( 2π / T0 )( k +1) t Spring-2005
jMc
10
0
SQUARE WAVE EXAMPLE
9/13/2006
EE-2025
.02
Spring-2005
jMc
k +1− ( k −1)
9/13/2006
4π ( k 2 −1)
− j ( 2π / T0 )( k −1)T0 / 2
)
)
(
)
− 1 − 4π (1k +1) e − j ( 2π / T0 )( k +1)T0 / 2 − 1
(
)
− 1 − 4π (1k +1) e − jπ ( k +1) − 1
⎧ 0 ⎪ 1 − (−1) k − 1 = ⎨ ±?j 4 ⎪ −1 ⎩ π ( k 2 −1)
)(
0
)
EE-2025
Spring-2005
k odd k = ±1 k even 11
jMc
Complex Amplitude for k-th Harmonic This one doesn’t depend on the period, T0
⎧ 1 ⎪ jπ k k 1 − ( −1) ⎪ ak = =⎨ 0 j 2π k ⎪ ⎪ 12 ⎩
1
.01
(
j 2T0 ( − j ( 2π / T0 )( k +1))
0
− jπ ( k −1)
T0 / 2
ak is a function of k
x(t)
0
1 4π ( k −1)
(e (e
e − j ( 2π / T0 )( k +1)t
Fourier Coefficients ak
⎧⎪1 0 ≤ t < 12 T0 x (t ) = ⎨ ⎪⎩0 12 T0 ≤ t < T0 for T0 = 0.04 sec.
–.02
=
T0 / 2
j 2T0 ( − j ( 2π / T0 )( k +1))
EE-2025
0
−
j 2T0 ( − j ( 2π / T0 )( k −1)) 1 4π ( k −1)
=
0
T0 / 2
e − j ( 2π / T0 )( k −1)t
=
T0 / 2 1 j 2T0
0
e − j ( 2π / T0 )( k −1) t
ak =
dt
0 T0 / 2
FS: Rectified Sine Wave {ak}
0.04
t 12
9/13/2006
EE-2025
Spring-2005
k = ±1,±3,K k = ±2,±4,K k =0 jMc
15
Spectrum from Fourier Series ⎧− j ⎪πk ⎪ ak = ⎨ 0 ⎪ ⎪ 12 ⎩
ω0 = 2π /(0.04) = 2π (25)
k = ±1,±3,K k = ±2,±4,K k =0
Fourier Series Synthesis HOW do you APPROXIMATE x(t) ?
ak =
T0 1 T0
− j ( 2π / T0 ) k t x ( t ) e dt ∫ 0
Use FINITE number of coefficients
x (t ) =
N
j 2π k f 0 t a e ∑ k
a−k = ak*
when x (t ) is real
k =− N 9/13/2006
EE-2025
Spring-2005
jMc
16
EE-2025
Spring-2005
jMc
EE-2025
Spring-2005
jMc
17
Synthesis: 1st & 3rd Harmonics
Fourier Series Synthesis
9/13/2006
9/13/2006
y (t ) =
18
9/13/2006
1 2 2 + cos(2π ( 25)t − π2 ) + cos(2π (75)t − π2 ) 2 π 3π
EE-2025
Spring-2005
jMc
19
Synthesis: up to 7th Harmonic 2 2 1 2 2 y (t ) = + cos(50π t − π2 ) + sin(150π t ) + sin( 250π t ) + sin(350π t ) 5π 7π 2 π 3π
9/13/2006
EE-2025
Spring-2005
jMc
20
Gibbs’ Phenomenon
Fourier Synthesis x N (t ) =
1 2 2 + sin(ω0t ) + sin(3ω0t ) + K 2 π 3π
9/13/2006
EE-2025
Spring-2005
jMc
21
Fourier Series Demos
Convergence at DISCONTINUITY of x(t)
Fourier Series Java Applet
There is always an overshoot 9% for the Square Wave case
Greg Slabaugh Interactive http://users.ece.gatech.edu/mcclella/2025/Fsdemo_Slabaugh/fourier.html
MATLAB GUI: fseriesdemo http://users.ece.gatech.edu/mcclella/matlabGUIs/index.html 9/13/2006
EE-2025
Spring-2005
jMc
22
9/13/2006
EE-2025
Spring-2005
jMc
23
fseriesdemo GUI
9/13/2006
EE-2025
Spring-2005
jMc
24
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chap 4, Sections 4-1 and 4-2 Replaces Ch 4 in DSP First, pp. 83-94
Lecture 8 Sampling & Aliasing
9/14/2003
Other Reading: Recitation: Strobe Demo (Sect 4-3) Next Lecture: Chap. 4 Sects. 4-4 and 4-5
9/14/2003
1
© 2003, JH McClellan & RW Schafer
LECTURE OBJECTIVES
3
© 2003, JH McClellan & RW Schafer
SYSTEMS Process Signals
SAMPLING can cause ALIASING
x(t)
Sampling Theorem Sampling Rate > 2(Highest Frequency)
SYSTEM
y(t)
PROCESSING GOALS:
Spectrum for digital signals, x[n]
Change x(t) into y(t)
Normalized Frequency
For example, more BASS
2πf + 2π ωˆ = ωTs = fs
Improve x(t), e.g., image deblurring Extract Information from x(t)
ALIASING
9/14/2003
© 2003, JH McClellan & RW Schafer
4
9/14/2003
© 2003, JH McClellan & RW Schafer
5
System IMPLEMENTATION
SAMPLING x(t)
ANALOG/ELECTRONIC:
SAMPLING PROCESS
Circuits: resistors, capacitors, op-amps x(t)
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
y(t)
ELECTRONICS
UNIFORM SAMPLING at t = nTs
DIGITAL/MICROPROCESSOR
IDEAL: x[n] = x(nTs)
Convert x(t) to numbers stored in memory x(t)
A-to-D
x[n]
9/14/2003
COMPUTER
y[n]
D-to-A
x(t)
y(t)
© 2003, JH McClellan & RW Schafer
6
9/14/2003
C-to-D
x[n]
© 2003, JH McClellan & RW Schafer
7
© 2003, JH McClellan & RW Schafer
9
f = 100Hz
SAMPLING RATE, fs SAMPLING RATE (fs) fs =1/Ts
f s = 2 kHz
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) 9/14/2003
C-to-D
f s = 500Hz
x[n]=x(nTs)
© 2003, JH McClellan & RW Schafer
8
9/14/2003
SAMPLING THEOREM
Reconstruction? Which One? Given the samples, draw a sinusoid through the values
HOW OFTEN ? DEPENDS on FREQUENCY of SINUSOID ANSWERED by SHANNON/NYQUIST Theorem ALSO DEPENDS on “RECONSTRUCTION”
x[n ] = cos(0.4π n ) 9/14/2003
© 2003, JH McClellan & RW Schafer
10
9/14/2003
When n is an integer cos(0.4π n ) = cos(2.4π n )
© 2003, JH McClellan & RW Schafer
STORING DIGITAL SOUND
DISCRETE-TIME SINUSOID
x[n] is a SAMPLED SINUSOID
Change x(t) into x[n]
11
DERIVATION
x (t ) = A cos(ω t + ϕ ) x[n ] = x ( nTs ) = A cos(ω nTs + ϕ )
A list of numbers stored in memory
EXAMPLE: audio CD CD rate is 44,100 samples per second
x[n ] = A cos((ωTs )n + ϕ )
16-bit samples Stereo uses 2 channels
x[n ] = A cos(ωˆ n + ϕ ) ωˆ = ω Ts = ωf DEFINE DIGITAL FREQUENCY
Number of bytes for 1 minute is 2 X (16/8) X 60 X 44100 = 10.584 Mbytes
s
9/14/2003
© 2003, JH McClellan & RW Schafer
12
9/14/2003
© 2003, JH McClellan & RW Schafer
13
ωˆ
DIGITAL FREQUENCY
SPECTRUM (DIGITAL)
ωˆ
f ωˆ = 2π fs
VARIES from 0 to 2π π, as f varies from 0 to the sampling frequency UNITS are radians, not rad/sec
9/14/2003
f s = 100 Hz
1 2
X*
X
2π(0.1) π(0.1)
ωˆ
2πf fs 14
© 2003, JH McClellan & RW Schafer
f fs
1 2
x[n ] = A cos(2π (100)( n / 1000) + ϕ )
SPECTRUM (DIGITAL) ??? ωˆ = 2π
X*
–0.2π π
f s = 1 kHz
DIGITAL FREQUENCY is NORMALIZED
ωˆ = ωTs =
1 2
?
–2π π
1 2
x[n ] = A cos(2π (100)( n / 100) + ϕ )
© 2003, JH McClellan & RW Schafer
15
The REST of the STORY
X
2π(1) π(1)
9/14/2003
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
A cos(ωˆ n + ϕ ) = A cos((ωˆ + 2π )n + ϕ )
x[n] is zero frequency??? 9/14/2003
© 2003, JH McClellan & RW Schafer
16
9/14/2003
© 2003, JH McClellan & RW Schafer
17
ALIASING DERIVATION Other Frequencies give the same
ALIASING DERIVATION–2
ωˆ
Other Frequencies give the same
x1 (t ) = cos(400π t ) sampled at f s = 1000 Hz
If x (t) = A cos( 2 π ( f + f s )t + ϕ )
n x1[n ] = cos(400π 1000 ) = cos(0.4π n )
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 )
9/14/2003
then : ωˆ =
2π ( f + f s ) 2π f 2π f s = + fs fs fs
ωˆ = ωTs =
2400π − 400π = 2π (1000) © 2003, JH McClellan & RW Schafer
18
9/14/2003
2π f + 2π fs
© 2003, JH McClellan & RW Schafer
ALIASING CONCLUSIONS
NORMALIZED FREQUENCY
ADDING fs or 2fs or –fs to the FREQ of x(t) gives exactly the same x[n]
DIGITAL FREQUENCY
The samples, x[n] = x(n/ fs ) are EXACTLY THE SAME VALUES
ωˆ = ωTs =
GIVEN x[n], WE CAN’T DISTINGUISH fo FROM (fo + fs ) or (fo + 2fs ) 9/14/2003
© 2003, JH McClellan & RW Schafer
t←
and we want : x[n] = Acos(ωˆ n + ϕ )
x2 (t ) = cos(2400π t ) sampled at f s = 1000 Hz
⇒ x2 [n ] = x1[n ]
ωˆ
20
9/14/2003
19
2πf + 2π fs
© 2003, JH McClellan & RW Schafer
21
n fs
SPECTRUM for x[n]
SPECTRUM (MORE LINES)
PLOT versus NORMALIZED FREQUENCY INCLUDE ALL SPECTRUM LINES ALIASES
f ωˆ = 2π fs f s = 1 kHz
ADD MULTIPLES of 2π π SUBTRACT MULTIPLES of 2π π
1 2
X
–1.8π π
1 2
X*
–0.2π π
1 2
X
2π(0.1) π(0.1)
1 2
X*
1.8π π
ωˆ
x[n ] = A cos(2π (100)( n / 1000) + ϕ )
FOLDED ALIASES (to be discussed later) ALIASES of NEGATIVE FREQS 9/14/2003
22
© 2003, JH McClellan & RW Schafer
SPECTRUM (ALIASING CASE) ωˆ = 2π
f fs
f s = 80 kHz
9/14/2003
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
9/14/2003
© 2003, JH McClellan & RW Schafer
23
SAMPLING GUI (con2dis)
X
2.5π π
ωˆ
x[n ] = A cos(2π (100)( n / 80) + ϕ )
© 2003, JH McClellan & RW Schafer
24
9/14/2003
© 2003, JH McClellan & RW Schafer
25
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) + ϕ )
9/14/2003
© 2003, JH McClellan & RW Schafer
26
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chapter 4: Sections 4-4, 4-5
Lecture 9 D-to-A Conversion
8/22/2003
© 2003, JH McClellan & RW Schafer
Other Reading: Recitation: Section 4-3 (Strobe Demo) Next Lecture: Chapter 5 (beginning)
8/22/2003
1
LECTURE OBJECTIVES
SIGNAL TYPES
FOLDING: a type of ALIASING DIGITAL-to-ANALOG CONVERSION is
x(t)
Reconstruction from samples Smooth Interpolation
x[n]
COMPUTER
y[n]
D-to-A
y(t)
Convert x(t) to numbers stored in memory
Mathematical Model of D-to-A
D-to-A Convert y[n] back to a “continuous-time” signal, y(t)
SUM of SHIFTED PULSES Linear Interpolation example
© 2003, JH McClellan & RW Schafer
A-to-D
A-to-D
SAMPLING THEOREM applies
8/22/2003
3
© 2003, JH McClellan & RW Schafer
y[n] is called a “discrete-time” signal 4
8/22/2003
© 2003, JH McClellan & RW Schafer
5
SAMPLING x(t)
NYQUIST RATE
UNIFORM SAMPLING at t = nTs
“Nyquist Rate” Sampling
IDEAL: x[n] = x(nTs) x(t)
C-to-D
fs > TWICE the HIGHEST Frequency in x(t) “Sampling above the Nyquist rate”
x[n]
BANDLIMITED SIGNALS DEF: x(t) has a HIGHEST FREQUENCY COMPONENT in its SPECTRUM NON-BANDLIMITED EXAMPLE TRIANGLE WAVE is NOT BANDLIMITED
8/22/2003
6
© 2003, JH McClellan & RW Schafer
8/22/2003
© 2003, JH McClellan & RW Schafer
SPECTRUM for x[n]
EXAMPLE: SPECTRUM
INCLUDE ALL SPECTRUM LINES
x[n] = Acos(0.2πn+φ) FREQS @ 0.2π and -0.2π ALIASES:
ALIASES ADD INTEGER MULTIPLES of
2π π and -2π π
FOLDED ALIASES
{2.2π, 4.2π, 6.2π, …} & {-1.8π,-3.8π,…} EX: x[n] = Acos(4.2πn+φ)
ALIASES of NEGATIVE FREQS
PLOT versus NORMALIZED FREQUENCY i.e., DIVIDE fo by fs 8/22/2003
ωˆ = 2π
© 2003, JH McClellan & RW Schafer
7
ALIASES of NEGATIVE FREQ:
f + 2π fs
{1.8π,3.8π,5.8π,…} & {-2.2π, -4.2π …}
8
8/22/2003
© 2003, JH McClellan & RW Schafer
9
SPECTRUM (ALIASING CASE)
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) π(0.1)
1 2
X*
1.8π π
ωˆ
f ωˆ = 2π fs f s = 80 kHz
x[n ] = A cos(2π (100)( n / 1000) + ϕ )
8/22/2003
© 2003, JH McClellan & RW Schafer
10
FOLDING (a type of ALIASING)
1 2
X*
–2.5π π
1 2
X
1 2
–1.5π π
X*
1 2
X
0.5π π
–0.5π π
1 2
X*
1 2
1.5π π
X
2.5π π
ωˆ
x[n ] = A cos(2π (100)( n / 80) + ϕ )
8/22/2003
11
© 2003, JH McClellan & RW Schafer
DIGITAL FREQ
ωˆ
AGAIN
EXAMPLE: 3 different x(t); same x[n] 100 ωˆ = 2π = 2π (0.1) f s = 1000 1000 cos(2π (100)t ) → cos[2π (0.1)n ] cos(2π (1100)t ) → cos[2π (1.1)n ] = cos[2π (0.1)n ] cos(2π (900)t ) → cos[2π (0.9)n ] = cos[2π (0.9)n − 2π n ] = cos[2π ( −0.1)n ] = cos[2π (0.1)n ]
900 Hz “folds” to 100 Hz when fs=1kHz 8/22/2003
© 2003, JH McClellan & RW Schafer
12
ωˆ = ωTs =
2π f + 2π fs
ωˆ = ωTs = − 8/22/2003
2π f + 2π fs
© 2003, JH McClellan & RW Schafer
ALIASING
FOLDED ALIAS
13
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
FREQUENCY DOMAINS
X
1.6π π
x(t)
A-to-D
x[n]
y[n]
f
ω
fˆ
f ωˆ ωˆ = 2π fs
+ 2π © 2003, JH McClellan & RW Schafer
y(t)
ωˆ
x[n ] = A cos(2π (100)( n / 125) + ϕ )
8/22/2003
D-to-A
14
8/22/2003
f =
ωˆ fs 2π
© 2003, JH McClellan & RW Schafer
f
15
SAMPLING GUI (con2dis)
DEMOS from CHAPTER 4 CD-ROM DEMOS SAMPLING DEMO (con2dis GUI) Different Sampling Rates Aliasing of a Sinusoid
STROBE DEMO Synthetic vs. Real Television SAMPLES at 30 fps
Sampling & Reconstruction 8/22/2003
© 2003, JH McClellan & RW Schafer
16
8/22/2003
© 2003, JH McClellan & RW Schafer
17
D-to-A Reconstruction x(t)
A-to-D
x[n]
y[n]
COMPUTER
D-to-A is AMBIGUOUS !
D-to-A
y(t)
ALIASING Given y[n], which y(t) do we pick ? ? ? INFINITE NUMBER of y(t)
Create continuous y(t) from y[n]
PASSING THRU THE SAMPLES, y[n]
IDEAL
D-to-A RECONSTRUCTION MUST CHOOSE ONE OUTPUT
If you have formula for y[n]
Replace n in y[n] with fst y[n] = Acos(0.2πn+φ) with fs = 8000 Hz y(t) = Acos(2π(800)t+φ) 8/22/2003
RECONSTRUCT THE SMOOTHEST ONE THE LOWEST FREQ, if y[n] = sinusoid 19
© 2003, JH McClellan & RW Schafer
SPECTRUM (ALIASING CASE) ωˆ = 2π
f fs
1 2
X*
π f s = 80Hz –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) + ϕ )
8/22/2003
20
© 2003, JH McClellan & RW Schafer
Reconstruction (D-to-A) CONVERT STREAM of NUMBERS to x(t) “CONNECT THE DOTS” INTERPOLATION INTUITIVE, conveys the idea
y[k] y(t) kTs
8/22/2003
© 2003, JH McClellan & RW Schafer
21
8/22/2003
(k+1)Ts
© 2003, JH McClellan & RW Schafer
t 22
SQUARE PULSE CASE
SAMPLE & HOLD DEVICE CONVERT y[n] to y(t) y[k] should be the value of y(t) at t = kTs Make y(t) equal to y[k] for kTs -0.5Ts < t < kTs +0.5Ts y[k]
STAIR-STEP APPROXIMATION
y(t) kTs 8/22/2003
(k+1)Ts
t
© 2003, JH McClellan & RW Schafer
23
OVER-SAMPLING CASE
8/22/2003
© 2003, JH McClellan & RW Schafer
24
MATH MODEL for D-to-A
EASIER TO RECONSTRUCT SQUARE PULSE:
8/22/2003
© 2003, JH McClellan & RW Schafer
25
8/22/2003
© 2003, JH McClellan & RW Schafer
26
EXPAND the SUMMATION ∞
∑ y[n]p(t − nT ) = s
n= −∞
…+ y[0]p(t) + y[1]p(t − Ts ) + y[2]p(t − 2Ts ) + …
p(t)
SUM of SHIFTED PULSES p(t-nTs) “WEIGHTED” by y[n] CENTERED at t=nTs SPACED by Ts RESTORES “REAL TIME” 8/22/2003
© 2003, JH McClellan & RW Schafer
27
TRIANGULAR PULSE (2X)
8/22/2003
© 2003, JH McClellan & RW Schafer
28
OPTIMAL PULSE ? CALLED “BANDLIMITED INTERPOLATION”
p (t ) =
sin πTst πt
for − ∞ < t < ∞
Ts
p(t ) = 0 for t = ±Ts , ± 2Ts ,… 8/22/2003
© 2003, JH McClellan & RW Schafer
29
8/22/2003
© 2003, JH McClellan & RW Schafer
30
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chapter 5, Sects. 5-1, 5-2 and 5-3 (partial)
Lecture 10 FIR Filtering Intro
Other Reading: Recitation: Ch. 5, Sects 5-4, 5-6, 5-7 and 5-8 CONVOLUTION
Next Lecture: Ch 5, Sects. 5-3, 5-5 and 5-6
2/18/2005
© 2003, JH McClellan & RW Schafer
2/18/2005
1
© 2003, JH McClellan & RW Schafer
3
LECTURE OBJECTIVES
DIGITAL FILTERING
INTRODUCE FILTERING IDEA
x(t)
Weighted Average Running Average
© 2003, JH McClellan & RW Schafer
COMPUTER
y[n]
D-to-A
y(t)
PROCESSING ALGORITHMS SOFTWARE (MATLAB) HARDWARE: DSP chips, VLSI
Filters
Show how to compute the output y[n] from the input signal, x[n]
2/18/2005
x[n]
CONCENTRATE on the COMPUTER
FINITE IMPULSE RESPONSE FILTERS
FIR
A-to-D
DSP: DIGITAL SIGNAL PROCESSING 4
2/18/2005
© 2003, JH McClellan & RW Schafer
5
The TMS32010, 1983
Rockland Digital Filter, 1971
First PC plug-in board from Atlanta Signal Processors Inc. For the price of a small house, you could have one of these. 2/18/2005
© 2003, JH McClellan & RW Schafer
6
Digital Cell Phone (ca. 2000)
2/18/2005
© 2003, JH McClellan & RW Schafer
7
DISCRETE-TIME SYSTEM x[n]
COMPUTER
y[n]
OPERATE on x[n] to get y[n] WANT a GENERAL CLASS of SYSTEMS ANALYZE the SYSTEM TOOLS: TIME-DOMAIN & FREQUENCYDOMAIN
SYNTHESIZE the SYSTEM 2/18/2005
Now it plays video © 2003, JH McClellan & RW Schafer
8
2/18/2005
© 2003, JH McClellan & RW Schafer
9
D-T SYSTEM EXAMPLES x[n]
SYSTEM
DISCRETE-TIME SIGNAL x[n] is a LIST of NUMBERS
y[n]
INDEXED by “n”
EXAMPLES: POINTWISE OPERATORS
STEM PLOT
SQUARING: y[n] = (x[n])2
RUNNING AVERAGE RULE: “the output at time n is the average of three consecutive input values” 2/18/2005
© 2003, JH McClellan & RW Schafer
10
3-PT AVERAGE SYSTEM
2/18/2005
© 2003, JH McClellan & RW Schafer
11
INPUT SIGNAL
ADD 3 CONSECUTIVE NUMBERS Do this for each “n” Make a TABLE
y[n ] = 13 ( x[n ] + x[n + 1] + x[n + 2])
y[n ] = 13 ( x[n ] + x[n + 1] + x[n + 2])
OUTPUT SIGNAL
n=0 2/18/2005
n=1
© 2003, JH McClellan & RW Schafer
12
2/18/2005
© 2003, JH McClellan & RW Schafer
13
PAST, PRESENT, FUTURE
ANOTHER 3-pt AVERAGER Uses “PAST” VALUES of x[n] IMPORTANT IF “n” represents REAL TIME WHEN x[n] & y[n] ARE STREAMS
y[n ] = 13 ( x[n ] + x[n − 1] + x[n − 2]) “n” is TIME
2/18/2005
© 2003, JH McClellan & RW Schafer
14
GENERAL CAUSAL FIR FILTER FILTER COEFFICIENTS {bk} DEFINE THE FILTER
2/18/2005
© 2003, JH McClellan & RW Schafer
15
GENERAL FIR FILTER FILTER COEFFICIENTS {bk}
M
M
y[n ] = ∑ bk x[n − k ]
y[n ] = ∑ bk x[n − k ]
k =0
k =0
For example, bk = {3, − 1, 2,1}
FILTER ORDER is M FILTER LENGTH is L = M+1
3
y[n ] = ∑ bk x[n − k ]
NUMBER of FILTER COEFFS is L
k =0
= 3x[n ] − x[n − 1] + 2 x[n − 2] + x[n − 3] 2/18/2005
© 2003, JH McClellan & RW Schafer
16
2/18/2005
© 2003, JH McClellan & RW Schafer
17
GENERAL CAUSAL FIR FILTER
FILTERED STOCK SIGNAL
SLIDE a WINDOW across x[n] M
y[n ] = ∑ bk x[n − k ]
INPUT
k =0
OUTPUT
x[n-M] 2/18/2005
x[n] © 2003, JH McClellan & RW Schafer
18
2/18/2005
50-pt Averager 19
© 2003, JH McClellan & RW Schafer
UNIT IMPULSE SIGNAL δ[n]
SPECIAL INPUT SIGNALS x[n] = SINUSOID FREQUENCY RESPONSE (LATER) x[n] has only one NON-ZERO VALUE
⎧⎪1 n = 0 δ [n ] = ⎨ ⎪⎩0 n ≠ 0
UNIT-IMPULSE
δ[n] is NON-ZERO When its argument is equal to ZERO
δ [n − 3]
n=3
1 n
2/18/2005
© 2003, JH McClellan & RW Schafer
20
2/18/2005
© 2003, JH McClellan & RW Schafer
21
SUM of SHIFTED IMPULSES
MATH FORMULA for x[n] Use SHIFTED IMPULSES to write x[n] x[n ] = 2δ [n ] + 4δ [n − 1] + 6δ [n − 2] + 4δ [n − 3] + 2δ [n − 4]
This formula ALWAYS works
2/18/2005
© 2003, JH McClellan & RW Schafer
22
4-pt AVERAGER
2/18/2005
y[n ] = 14 ( x[n ] + x[n − 1] + x[n − 2] + x[n − 3])
y[n ] = 14 ( x[n ] + x[n − 1] + x[n − 2] + x[n − 3])
δ[n] “READS OUT” the FILTER COEFFICIENTS
INPUT = UNIT IMPULSE SIGNAL = δ[n] x[n ] = δ [n ] y[n ] = 14 δ [n ] + 14 δ [n − 1] + 14 δ [n − 2] + 14 δ [n − 3]
h[n ] = {K , 0, 0, 14 , 14 , 14 , 14 , 0, 0, K} “h” in h[n] denotes Impulse Response
n=0 n=–1 n=0
OUTPUT is called “IMPULSE RESPONSE”
NON-ZERO When window overlaps δ[n]
1 n=1
h[n ] = {K , 0, 0, 14 , 14 , 14 , 14 , 0, 0, K} © 2003, JH McClellan & RW Schafer
23
4-pt Avg Impulse Response
CAUSAL SYSTEM: USE PAST VALUES
2/18/2005
© 2003, JH McClellan & RW Schafer
n n=4 n=5 24
2/18/2005
© 2003, JH McClellan & RW Schafer
25
FIR IMPULSE RESPONSE
FILTERING EXAMPLE
Convolution = Filter Definition Filter Coeffs = Impulse Response
7-point AVERAGER Removes cosine
6
y7 [n ] = ∑ (17 )x[n − k ]
k =0 By making its amplitude (A) smaller
M
y[n ] = ∑ bk x[n − k ] k =0
2/18/2005
3-point AVERAGER
M
y[n ] = ∑ h[k ] x[n − k ] k =0
Changes A slightly
y3[n ] = ∑ (13 )x[n − k ] k =0
CONVOLUTION
© 2003, JH McClellan & RW Schafer
26
Input : x[n ] = (1.02)n + cos(2π n / 8 + π / 4)
2/18/2005
© 2003, JH McClellan & RW Schafer
27
7-pt FIR EXAMPLE (AVG)
3-pt AVG EXAMPLE for 0 ≤ n ≤ 40
Input : x[n ] = (1.02)n + cos(2π n / 8 + π / 4)
for 0 ≤ n ≤ 40
CAUSAL: Use Previous
USE PAST VALUES
2/18/2005
2
© 2003, JH McClellan & RW Schafer
28
2/18/2005
© 2003, JH McClellan & RW Schafer
29
LONGER OUTPUT
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chapter 5, Sections 5-5 and 5-6 Section 5-4 will be covered, but not “in depth”
Lecture 11 Linearity & Time-Invariance Convolution
Other Reading: Recitation: Ch. 5, Sects 5-6, 5-7 & 5-8 CONVOLUTION
Next Lecture: start Chapter 6 8/22/2003
© 2003, JH McClellan & RW Schafer
8/22/2003
1
LECTURE OBJECTIVES
IMPULSE RESPONSE, h[n ]
LINEARITY LTI SYSTEMS TIME-INVARIANCE ==> CONVOLUTION
FIR case: same as {bk }
CONVOLUTION GENERAL: y[n ] = h[n ] ∗ x[n ] GENERAL CLASS of SYSTEMS
BLOCK DIAGRAM REPRESENTATION
LINEAR
Components for Hardware Connect Simple Filters Together to Build More Complicated Systems 8/22/2003
© 2003, JH McClellan & RW Schafer
3
OVERVIEW
GENERAL PROPERTIES of FILTERS
© 2003, JH McClellan & RW Schafer
and
TIME-INVARIANT
ALL LTI systems have h[n] & use convolution 4
8/22/2003
© 2003, JH McClellan & RW Schafer
5
DIGITAL FILTERING x(t)
A-to-D
x[n]
BUILDING BLOCKS
y[n]
FILTER
D-to-A
y(t)
x[n]
OUTPUT
FILTER
FILTER INPUT
CONCENTRATE on the FILTER (DSP)
BUILD UP COMPLICATED FILTERS
FUNCTIONS of n, the “time index” INPUT x[n] OUTPUT y[n]
FROM SIMPLE MODULES Ex: FILTER MODULE MIGHT BE 3-pt FIR 6
© 2003, JH McClellan & RW Schafer
+
FILTER
DISCRETE-TIME SIGNALS
8/22/2003
y[n]
+
8/22/2003
7
© 2003, JH McClellan & RW Schafer
GENERAL FIR FILTER
MATLAB for FIR FILTER
FILTER COEFFICIENTS {bk}
yy = conv(bb,xx) VECTOR bb contains Filter Coefficients DSP-First: yy = firfilt(bb,xx)
DEFINE THE FILTER
M
y[n ] = ∑ bk x[n − k ] k =0
For example, bk = {3, − 1, 2,1}
FILTER COEFFICIENTS {bk}
3
M
y[n ] = ∑ bk x[n − k ]
y[n ] = ∑ bk x[n − k ]
k =0
© 2003, JH McClellan & RW Schafer
for images
k =0
= 3x[n ] − x[n − 1] + 2 x[n − 2] + x[n − 3] 8/22/2003
conv2()
8
8/22/2003
© 2003, JH McClellan & RW Schafer
9
SPECIAL INPUT SIGNALS
FIR IMPULSE RESPONSE
x[n] = SINUSOID FREQUENCY RESPONSE x[n] has only one NON-ZERO VALUE
Convolution = Filter Definition Filter Coeffs = Impulse Response
1 n = 0 δ [n ] = 0 n ≠ 0 UNIT-IMPULSE
1
M M
hy[n ] = ∑ bkkδx[n − k ]
n 8/22/2003
kk==00
10
© 2003, JH McClellan & RW Schafer
8/22/2003
11
© 2003, JH McClellan & RW Schafer
MATH FORMULA for h[n]
LTI: Convolution Sum
Use SHIFTED IMPULSES to write h[n] h[n ] = δ [n ] − δ [n − 1] + 2δ [n − 2] − δ [n − 3] + δ [n − 4]
Output = Convolution of x[n] & h[n] NOTATION: y[n ] = h[n ] ∗ x[n ]
2
h[n ]
Here is the FIR case: FINITE LIMITS
1 0
bk = { 1, − 1, 2, − 1, 1 } 8/22/2003
M
4
y[n ] = ∑ h[k ]x[n − k ]
n
k =0
–1 © 2003, JH McClellan & RW Schafer
FINITE LIMITS
Same as bk 12
8/22/2003
© 2003, JH McClellan & RW Schafer
13
CONVOLUTION Example
GENERAL FIR FILTER
h[n ] = δ [n ] − δ [n − 1] + 2δ [n − 2] − δ [n − 3] + δ [n − 4] x[n ] = u[n ]
SLIDE a Length-L WINDOW over x[n]
n −1 0
1
2
3
4
5
6
7
x[n] h[n]
0 0
1 1 1 −1
1 1 2 −1
1 1
1 0
1 0
... 0
h[0] x[n ] h[1] x[n − 1] h[2]x[n − 2] h[3]x[n − 3] h[4]x[n − 4]
0
1
1
1
1
1
1
y[n]
0
8/22/2003
0 0
1
1
−1 −1 −1 −1 −1 −1 −1
0 0 0 0
0 0
2 2 2 2 2 2 0 −1 −1 −1 −1 −1
0 0
0
0
0
1
1
1
1
0
2
1
2
2
2
...
1
© 2003, JH McClellan & RW Schafer
x[n-M] 14
DCONVDEMO: MATLAB GUI
8/22/2003
x[n] © 2003, JH McClellan & RW Schafer
15
POP QUIZ FIR Filter is “FIRST DIFFERENCE” y[n] = x[n] - x[n-1]
INPUT is “UNIT STEP” 1 n ≥ 0 u[n ] = 0 n < 0
Find y[n] 8/22/2003
© 2003, JH McClellan & RW Schafer
16
8/22/2003
y[n ] = u[n ] − u[n − 1] = δ [n ] © 2003, JH McClellan & RW Schafer
17
HARDWARE STRUCTURES x[n]
FILTER
y[n]
HARDWARE ATOMS
M
y[n ] = ∑ bk x[n − k ]
Add, Multiply & Store
M
y[n ] = ∑ bk x[n − k ] k =0
k =0
INTERNAL STRUCTURE of “FILTER” WHAT COMPONENTS ARE NEEDED? HOW DO WE “HOOK” THEM TOGETHER?
y[n ] = x1[n ] + x2 [n ]
y[n ] = β x[n ]
SIGNAL FLOW GRAPH NOTATION 8/22/2003
18
© 2003, JH McClellan & RW Schafer
SIGNAL FLOW GRAPH
19
© 2003, JH McClellan & RW Schafer
Moore’s Law for TI DSPs
FIR STRUCTURE Direct Form
y[n ] = x[n − 1]
8/22/2003
M
LOG SCALE
y[n ] = ∑ bk x[n − k ] k =0
Double every 18 months ?
8/22/2003
© 2003, JH McClellan & RW Schafer
20
8/22/2003
© 2003, JH McClellan & RW Schafer
21
SYSTEM PROPERTIES x[n]
SYSTEM
TIME-INVARIANCE IDEA:
y[n]
“Time-Shifting the input will cause the same time-shift in the output”
MATHEMATICAL DESCRIPTION TIME-INVARIANCE LINEARITY CAUSALITY
EQUIVALENTLY, We can prove that The time origin (n=0) is picked arbitrary
“No output prior to input” 8/22/2003
© 2003, JH McClellan & RW Schafer
22
TESTING Time-Invariance
8/22/2003
© 2003, JH McClellan & RW Schafer
23
LINEAR SYSTEM LINEARITY = Two Properties SCALING “Doubling x[n] will double y[n]”
SUPERPOSITION: “Adding two inputs gives an output that is the sum of the individual outputs”
8/22/2003
© 2003, JH McClellan & RW Schafer
24
8/22/2003
© 2003, JH McClellan & RW Schafer
25
TESTING LINEARITY
LTI SYSTEMS LTI:
Linear & Time-Invariant
COMPLETELY CHARACTERIZED by: IMPULSE RESPONSE h[n] CONVOLUTION: y[n] = x[n]*h[n] The “rule”defining the system can ALWAYS be rewritten as convolution
FIR Example: h[n] is same as bk 8/22/2003
© 2003, JH McClellan & RW Schafer
26
POP QUIZ
8/22/2003
27
© 2003, JH McClellan & RW Schafer
CASCADE SYSTEMS
FIR Filter is “FIRST DIFFERENCE”
Does the order of S1 & S2 matter?
y[n] = x[n] - x[n -1]
NO, LTI SYSTEMS can be rearranged !!! WHAT ARE THE FILTER COEFFS? {bk}
Write output as a convolution Need impulse response
h[n ] = δ [n ] − δ [n − 1] Then, another way to compute the output:
y[n ] = (δ [n ] − δ [n − 1]) ∗ x[n ]
8/22/2003
© 2003, JH McClellan & RW Schafer
S1 28
8/22/2003
S2 © 2003, JH McClellan & RW Schafer
29
CASCADE EQUIVALENT Find “overall” h[n] for a cascade ?
S1
S2
S2 8/22/2003
S1 © 2003, JH McClellan & RW Schafer
30
READING ASSIGNMENTS
Signal Processing First
This Lecture: Chapter 6, Sections 6-1, 6-2, 6-3, 6-4, & 6-5
Lecture 12 Frequency Response of FIR Filters
Other Reading: Recitation: Chapter 6 FREQUENCY RESPONSE EXAMPLES
Next Lecture: Chap. 6, Sects. 6-6, 6-7 & 6-8
2/25/2005
© 2003, JH McClellan & RW Schafer
2/25/2005
1
LECTURE OBJECTIVES
Time-Domain: “n” = time x[n] x(t)
DETERMINE the FIR FILTER OUTPUT
PLOTTING vs. Frequency MAGNITUDE vs. Freq PHASE vs. Freq jωˆ
© 2003, JH McClellan & RW Schafer
discrete-time signal continuous-time signal
Frequency Domain (sum of sinusoids) MAG
Spectrum vs. f (Hz) • ANALOG vs. DIGITAL
PHASE
H ( e ) = H ( e jωˆ ) e j∠H ( e
2/25/2005
3
DOMAINS: Time & Frequency
SINUSOIDAL INPUT SIGNAL
FREQUENCY RESPONSE of FIR
© 2003, JH McClellan & RW Schafer
4
jωˆ
Spectrum vs. omega-hat )
Move back and forth QUICKLY 2/25/2005
© 2003, JH McClellan & RW Schafer
5
DIGITAL “FILTERING” x(t)
A-to-D
x[n]
FILTER
y[n]
ωˆ
FILTERING EXAMPLE
D-to-A
y(t)
7-point AVERAGER Removes cosine
SINUSOIDAL INPUT
3-point AVERAGER
INPUT x[n] = SUM of SINUSOIDS Then, OUTPUT y[n] = SUM of SINUSOIDS © 2003, JH McClellan & RW Schafer
Changes A slightly
8
3-pt AVG EXAMPLE Input : x[n ] = (1.02)n + cos(2π n / 8 + π / 4)
2/25/2005
2
y3[n ] = ∑ (13 )x[n − k ] k =0
© 2003, JH McClellan & RW Schafer
9
7-pt FIR EXAMPLE (AVG) for 0 ≤ n ≤ 40
Input : x[n ] = (1.02)n + cos(2π n / 8 + π / 4)
for 0 ≤ n ≤ 40
CAUSAL: Use Previous
USE PAST VALUES
2/25/2005
y7 [n ] = ∑ (17 )x[n − k ]
k =0 By making its amplitude (A) smaller
ωˆ
CONCENTRATE on the SPECTRUM
2/25/2005
6
© 2003, JH McClellan & RW Schafer
10
2/25/2005
© 2003, JH McClellan & RW Schafer
11
LONGER OUTPUT
DCONVDEMO: MATLAB GUI
SINUSOIDAL RESPONSE INPUT: x[n] = SINUSOID OUTPUT: y[n] will also be a SINUSOID Different Amplitude and Phase
SAME Frequency AMPLITUDE & PHASE CHANGE Called the FREQUENCY RESPONSE 2/25/2005
© 2003, JH McClellan & RW Schafer
12
COMPLEX EXPONENTIAL
x[n ] = Ae jϕ e jωˆ n
2/25/2005
Use the FIR “Difference Equation”
k =0
k =0
M
M
k =0
k =0
y[n ] = ∑ bk x[n − k ] = ∑ bk Ae jϕ e jωˆ ( n −k )
x[n] is the input signal—a complex exponential
M
13
COMPLEX EXP OUTPUT
−∞
View more...
Comments