ECE 2026 Summer 2022
LECTURE #4Fourier Series and Instantaneous FrequencyWed May 25, 2022
MATLAB review tonight
Ch. 3 Reading:
Monday:
Today
3
The Fourier Series
A periodic signal satisfies x( t) = x( t + T0) for all t.
Any periodic signal can be written as
with harmonically related frequencies, whose amplitudes and phases are determined by the FS coefficients:
smallest is fundamental period
0
0
0
0ak = dt
t0 T0
……
“FS synthesis”
“FS analysis”
Analysis Not Always Necessary
ECE-2026 Spring 2022 5
ECE-2026 Spring 2022 6
Motivating Example: A Sawtooth Wave
0 0.1 t
2π
Derivation of FS Coeffsa0 = π
ak = j/k
0
Resulting spectrum:
a1 = j
a2 = j/2
Sawtooth Example:
a0 = π
ak = j/k
0
Spectrum: a1= j
a2= j/2
ak0
0
,
,
k
jk
k
π ==
≠
f [Hz]
f0 = 10 Hz
0 0.1
2π
T0 = 0.1
20 30 40 50 60
+40 Hz
+30 Hz
+20 Hz
Periodic signal = sum of sinusoids:
• Harmonic:Sinusoid freq’s all multiples of f0(Spectrum lines spaced by f0)
• Amp & phase determined by FS coeffs
constant+10 Hz
2 questions:
• Is sum of harmonic sinusoids always periodic?
• Can anything periodic be written this way?
5/23/2022 ECE-2026 Spring 2022 11
Fourier Series Demofseriesdemo
FS of 50% Square Wave?
0.10 0.05
π
t
x( t )
……
T0 = 0.1
Resulting Spectrum
a0 = π/2
ak = j/k
0
a1= j
f [Hz]
f0 = 10 Hz
30 50 70 90
As Sums of Sinusoids
t=0:1e-4:0.4;
x=pi;
for k=1:1:400; x = x - 2*sin(20*pi*k*t)/k; end;
y=pi/2;
for k=1:2:400; y = y - 2*sin(20*pi*k*t)/k; end;
plot(t,x,t,y);
14
Gibbs Phenomenon
Analogy
3D Vectors Periodic SignalsDot product
orthogonal basis {u1, u2, u3}
x = a1u1 + a2u2 + a3u3
ak = x . uk
{ }02 /
k
jk t Te∞
=−∞
π
02 /( ) jk t Tk
k
x t a e∞
π
=−∞
= ∑
0
0
0
1 2 /( ) jk t Tk T
T
a x t e dt− π= ∫
integral
A complex periodic z( t ) = akejk2πt
K
k K=−∑
Works for complex periodic z( t ) too
K = 3 K = 10 K = 30
K = 100 K = 300 K = 10,000
For more FS animations see https://youtu.be/-qgreAUpPwM
19
YES
Sum of Sinusoids: Periodic?
NO
YES
NO
T 0 = 0.1
Fun FS Facts If x(t) real then a −k = a k * “Hermitian” symmetry The zero-th “DC” coeff is often computed separately,
can interpret as “average” value If x(t) is even, a k are purely real:
If x(t) is odd, a k are purely imaginary. Integration not always needed to find FS coeffs.
Pop Quiz
23
Pop Quiz: Is This Signal Periodic?
What is the fundamental frequency?
(0.1)GCD(104,240) = (0.1)(8) = 0.8 Hz
0 10.4 24–10.4–24 f (in Hz)
37 /πje 37 /π−je2/4 πje− 24 /πje
10
Arbitrary Duty Cycle
ECE-2026 Spring 2022 24
5/23/2022 25
Time-Varying Frequency Chirp:
How to define “instantaneous” frequency? Break signal into sections Estimate frequency for each section Plot frequency estimates vs time
That’s what spectrogram doesspectrogram(x,2^12,[],2^14,fs,'yaxis')
5/23/2022 27
Instantaneous Frequency
When
Sanity check: pure sinusoid
“Angle” derivative1
2
( ) cos( ( ))
( ) ( )di dt
x t A t
f t tπ
= ψ
⇒ = ψ
0
0
2( ) cos( )
( )i
x t A f t
f t f
= π + ϕ⇒ =
5/23/2022 28
Linear Chirp
Derivative linear in time phase is quadratic in time:
2( ) cos( )x t A t t= α + β + ϕ
QUADRATIC
Pop Quiz: Create Linear Chirp
=ϕ=β=α
ϕ+β+α=⇒
where
2 )cos()( ttAtx
…that starts at 500 Hz, ends at 1000 Hz, and lasts for 4 seconds
Pop Quiz: Write Eqn for Siren
))sin(cos()( ϕ+γ+βα+ω=⇒ ttAtx
… where ω = 1000π, α = 25, β = 8π, γ = ϕ = 0
Spectral Analysis using FFTfs = 100;
t = 0:1/fs:10;
x = sin(2*pi*15*t) + 2*cos(2*pi*40*t + 0.3*pi) + randn(size(t));
plot(linspace(-fs/2,fs/2,length(x)),abs(fftshift(fft(x))));
xlabel('Frequency (Hz)')
What’s This?
TIME (seconds)
FRE
QU
EN
CY
(kH
Z)
0
5
https://youtu.be/N2njKC5Iix8?t=10
spectrogram(x,1024,[],1024,fs,'yaxis');
5/23/2022 ECE-2026 Spring 2022 33
SPECTROGRAM
MATLAB function is spectrogram.m SP-First has plotspec.m & spectgr.m Takes x( t ) as input Breaks x( t ) into short segments then uses the FFT (Fast Fourier Transform) produces spectrum values Xk