Lecture 14 Ece4330t
Lecture 14 Ece4330t
Lecture 14
The Fourier Series
Prof. Mohamad Hassoun
Refer to your textbook (pp. 184-186 and Section 3.8) for derivation of the
above formulas. Also, refer to the last section of this lecture for additional
insight into the nature of the Fourier coefficients.
Example. Approximation of a square wave using a truncated Fourier
series (𝑛 = 3, 5, 7)
fourier_series_animati fourier_series_animati
on_square_wave.avi on_triangle_wave.avi
−𝑏𝑛
𝐶𝑛 = √𝑎𝑛 2 + 𝑏𝑛 2 , 𝜃𝑛 = tan−1 ( )
𝑎𝑛
𝑓(𝑡) = 𝐶0 + ∑ 𝐶𝑛 cos(𝑛𝜔𝑜 𝑡 + 𝜃𝑛 ) , 𝐶0 = 𝑎0
𝑛=1
In practice, the signal 𝑓(𝑡) is a physical (real-valued, laboratory
generated) signal. For physical periodic signals we have,
lim 𝑎𝑛 = lim 𝑏𝑛 = lim 𝐶𝑛 = 0
𝑛→∞ 𝑛→∞ 𝑛→∞
1. ∫ |𝑓 (𝑡)|𝑑𝑡 < ∞
𝑇𝑜
The above two conditions are known as the Strong Dirichlet Conditions.
Fortunately, all physical signals meet these conditions.
2. The signal has one maximum, one minimum and one discontinuity.
Therefore, 𝑓(𝑡) satisfies the Strong Dirichlet conditions→ FS exists.
1 𝜋 −𝑡 2 −
𝜋
𝑎0 = ∫ 𝑒 𝑑𝑡 = (1 − 𝑒 2 ) ≅ 0.504
2
𝜋 0 𝜋
2 𝜋 −𝑡
𝑎𝑛 = ∫ 𝑒 2 cos(2𝑛𝑡) 𝑑𝑡
𝜋 0
2 𝜋 −𝑡
𝑏𝑛 = ∫ 𝑒 2 sin(2𝑛𝑡) 𝑑𝑡
𝜋 0
𝑡
−
2 𝑒 1 2 𝜋
𝑎𝑛 = { [− cos(2𝑛𝑡) + (2𝑛) sin(2𝑛𝑡)]} |
𝜋 1 2 2 0
(− 2) + (2𝑛)2
Simplifying, we obtain
𝜋 𝜋
−2 −2
4(1−𝑒 ) 16𝑛(1−𝑒 )
𝑎𝑛 = 𝜋(1+16𝑛2 ). Similarly, one can show that 𝑏𝑛 = .
𝜋(1+16𝑛2 )
2 −
𝜋
𝐶0 = 𝑎0 = (1 − 𝑒 2 ) ≅ 0.504
𝜋
𝜋
−
2 4 (1 − 𝑒 ) 2
𝐶𝑛 = √𝑎𝑛 + 𝑏𝑛
2 =
𝜋 √1 + 16𝑛2
−𝑏 𝑏
𝜃𝑛 = tan−1 ( 𝑎 𝑛) = − tan−1 (𝑎𝑛 ) = − tan−1 (4𝑛) [Note: 𝑎𝑛 > 0]
𝑛 𝑛
Therefore, the Fourier series expansion is (recall that 𝜔0 = 2),
∞ 𝜋
−2
2 𝜋
−2 4 1−𝑒
𝑓 (𝑡) = (1 − 𝑒 )+ ∑ [cos(2𝑛𝑡) + 4𝑛 sin(2𝑛𝑡)]
𝜋 𝜋 1 + 16𝑛2
𝑛=1
or, in compact form,
∞ 𝜋
−2
2 𝜋
−2 4 1−𝑒
𝑓 (𝑡) = (1 − 𝑒 )+ ∑ cos[2𝑛𝑡 − tan−1 (4𝑛)]
𝜋 𝜋 √1 + 16𝑛 2
𝑛=1
Mathcad solution
The amplitude and angle spectra for this signal are as follows (recall that
𝜔𝑜 = 2):
K
lim 𝐶𝑛 = lim →0 (at a rate of 1/𝑛)
𝑛→∞ 𝑛→∞ √1 + 16𝑛2
1 1
So, we may write: 𝐶𝑛 ∝ 𝑛 or 𝐶𝑛 = 𝑂 (𝑛) (relatively slow convergence)
1 𝜋 −𝑡 2 1 𝜋 −𝑡
𝑃𝑓 = ∫ (𝑒 2 ) 𝑑𝑡 = ∫ 𝑒 𝑑𝑡 ≅ 0.3046
𝜋 0 𝜋 0
6
1
𝑃𝑓,7 = 𝐶02 + ∑ 𝐶𝑛2 = 0.2997 ≅ 98.4% 𝑜𝑓 𝑃𝑓
2
𝑛=1
where 𝑃𝑓,7 represents the average power in the first seven terms of the
series. The following is a plot for the average power as a function of the
number of terms included in the power calculations,
Signal Symmetry Considerations
𝑓(𝑡) Symmetry Trigonometric FS Coefficients
2𝜋
with 𝑇𝑜 = 2 and 𝜔0 = =𝜋
𝑇𝑜
By inspection, the area under |𝑓 (𝑡)| over one period is finite. Also, within
one period, the signal has a finite number of maxima (1), minima (1) and
jump discontinuities (0). Therefore, the Fourier series expansion exists for
this signal.
𝑎0 = 0 (by inspection, the signal’s average is zero)
The signal is odd, (𝑡) = −𝑓(−𝑡) → 𝑎𝑛 = 0.
𝑇
Also, 𝑓(𝑡) = −𝑓 (𝑡 ± 2𝑜 ) = −𝑓(𝑡 ± 1), therefore the signal has half-
wave symmetry → 𝑎𝑛 = 𝑏𝑛 = 0 for 𝑛 even.
8 𝜋 8 𝜋 8 𝜋
𝑓(𝑡) = cos (𝜋𝑡 − ) + 2 cos (3𝜋𝑡 + ) + cos (5𝜋𝑡 − )
𝜋2 2 9𝜋 2 25𝜋 2 2
8 𝜋
+ cos (7𝜋𝑡 + ) + ⋯
49𝜋 2 2
Convergence rate of the series coefficients, 𝐶𝑛 :
1
The coefficients converge as 𝐶𝑛 = 𝑂 (𝑛2 ), which indicates a relatively fast
convergence.
Signal Power:
3
1 2
𝑃𝑓 = ̅̅̅̅
∫ 𝑓 2 (𝑡)𝑑𝑡 = 0.333 (your turn: verify)
2 − 1
2
𝑃𝑓,2 ≅ 0.3285 + 0.0040 = 0.3325
1 2 1 2
𝐶1 𝐶3
2 2
1
Because of the 𝑂 (𝑛2 ) convergence of the series coefficients, the power in
the signal can be well approximated by the power in the dc and first few
harmonics (two harmonics and no dc term in this case).
Predicting convergence rate for 𝐶𝑛 from the plot of 𝑓(𝑡)
If within one period 𝑓(𝑡) has:
1
(1) One or more jump discontinuity 𝐶𝑛 = 𝑂 ( )
𝑛
(2) No jump discontinuity in 𝑓 (𝑡), but 𝑓′(𝑡)
1
has a jump discontinuity 𝐶𝑛 = 𝑂 (𝑛2 )
(3) No jump discontinuity in 𝑓(𝑡) and 𝑓 ′ (𝑡),
1
but with a jump discontinuity in 𝑓 ′′ (𝑡) 𝐶𝑛 = 𝑂 (𝑛3 )
(4) 𝑓(𝑡) and all of its derivatives have no jump discontinuities, then
1
𝐶𝑛 = 𝑂 (𝑛∞) = 𝑂(0) which implies that the expansion is exact
with a finite number of FS terms. Example: 𝑓 (𝑡) = cos 𝑚 (𝜔𝑜 𝑡), 𝑚
is a positive integer.
Example 3. Consider the following square wave. Determine its Fourier
series.
𝑇0 = 2
2𝜋
𝜔0 = =𝜋
𝑇𝑜
𝑎0 = 0 (by inspection of area under the curve)
Symmetries in 𝑓(𝑡):
Even signal → 𝑏𝑛 = 0
𝑇
Half-wave symmetry exists (by inspecting the plot, −𝑓 (𝑡) = 𝑓(𝑡 − 2),
then 𝑎𝑛 = 0 for even 𝑛.
Convergence rate of the 𝐶𝑛 coefficients:
1
Jump discontinuity exists in 𝑓(𝑡), therefore 𝐶𝑛 = 𝑂 (𝑛).
The Fourier series expansion of 𝑓(𝑡) is given by (𝜔0 = 𝜋),
∞
𝑓 (𝑡) = ∑ 𝑎𝑛 cos(𝑛𝜋𝑡)
𝑛=1
𝑛 𝑜𝑑𝑑
Your turn: Solve the integral by hand. Repeat using Mathcad or Matlab.
Alternative method
We can take advantage of the Fourier series expansion for the triangular
signal [call it 𝑓2 (𝑡)] obtained in Example 2. Notice that the square wave in
question [call it 𝑓1 (𝑡)] is the derivative of the triangular wave, as can be
seen graphically,
𝑑𝑓2 (𝑡 )
So, we can obtain the Fourier series expansion of 𝑓1 (𝑡) as 𝑑𝑡
8 𝑑 𝜋 1 𝜋
𝑓1 (𝑡) = 2 [cos (𝜋𝑡 − ) + cos (3𝜋𝑡 + )
𝜋 𝑑𝑡 2 9 2
1 𝜋 1 𝜋
+ cos (5𝜋𝑡 − ) + cos (7𝜋𝑡 + ) + ⋯]
25 2 49 2
8 𝜋 1 𝜋 1 𝜋
= (− sin (𝜋𝑡 − ) − sin (3𝜋𝑡 + ) − sin (5𝜋𝑡 − )
𝜋 2 3 2 5 2
1 𝜋
− sin (7𝜋𝑡 + ) + ⋯ )
7 2
𝜋
Next, we employ the identity sin (𝑥 ∓ 2 ) = ∓cos(𝑥) to rewrite the
expansion in terms of cosines,
8 1 1 1
𝑓1 (𝑡) = (cos 𝜋𝑡 − cos 3𝜋𝑡 + cos 5𝜋𝑡 − cos(7𝜋𝑡) + ⋯ )
( ) ( ) ( )
𝜋 3 5 7
The compact trigonometric representation requires 𝐶𝑛 ≥ 0. Thus, we
rewrite the expression as (the negative sign in the second and fourth terms
are absorbed into the corresponding cosine term as an angle of ±𝜋),
8 1 1 1
𝑓1 (𝑡) = (cos(𝜋𝑡) + cos(3𝜋𝑡 ± 𝜋) + cos(5𝜋𝑡) + cos(7𝜋𝑡 ± 𝜋) + ⋯ )
𝜋 3 5 7
The following is a plot of the signal 𝑓1 (𝑡) and its approximation 𝑓̃1 (𝑡)
using the first three-harmonics,
Mathcad solution (including all terms up to 𝑛 = 7)
Spectra:
Your turn: Consider the signal, 𝑓(𝑡) = 𝑡, 0 < 𝑡 < 1 and 𝑓 (𝑡 + 1) = 𝑓(𝑡).
(a) Predict the order of convergence of the Fourier series coefficient
𝐶𝑛 . (b) Find the compact trigonometric Fourier series. (c) Compare the
signal’s exact power to that obtained using the dc and first 5 harmonic
terms. (d) Verify your work employing the provided Mathcad Fourier
series worksheet.
1 1 1
Ans. (b) 𝑓 (𝑡) = − ∑∞
𝑛=1 sin(2𝜋𝑛𝑡)
2 𝜋 𝑛
Your turn: Consider the signal, 𝑓(𝑡) = 𝑡 2 , −𝜋 < 𝑡 < 𝜋 and 𝑓(𝑡 + 2𝜋) = 𝑓(𝑡)
(a) Predict the order of convergence of the Fourier series coefficient
𝐶𝑛 . (b) Find the compact trigonometric Fourier series. (c) Compare the
signal’s exact power to that obtained using the dc and first 5 harmonic
terms. (d) Verify your work employing the provided Mathcad Fourier
series worksheet.
𝜋2 (−1)𝑛
Ans. (b) 𝑓 (𝑡) = + 4 ∑∞
𝑛=1 cos(𝑛𝑡)
3 𝑛2
can be obtained as the solution that minimizes the LSE criterion (error
function)
𝑇0
2 2
𝐸(𝑎0 , 𝑎1 , 𝑎2, … , 𝑎𝑚 , 𝑏1 , 𝑏2, … , 𝑏𝑚 ) = ∫ [𝑓 (𝑡) − 𝑓̃(𝑡)] 𝑑𝑡
𝑇
− 0
2
Once the equations are formulated, Mathcad or Matlab can then be used to
solve the resulting system of (generally, nonlinear) equations numerically.
Your turn: Solve the above optimization problem by solving the set of equations,
𝜕𝐸 𝜕𝐸 𝜕𝐸 𝜕𝐸 𝜕𝐸
= 0, = 0, = 0, = 0, =0
𝜕𝑎0 𝜕𝑎1 𝜕𝑏1 𝜕𝑎2 𝜕𝑏2
1 4 1
Ans. 𝑎0 = , 𝑎1 = − 2 , 𝑏1 = 0, 𝑎2 = and 𝑏2 = 0
3 𝜋 𝜋2
Your turn: If you are to sample the function 𝑓(𝑡) at 𝑚 (say, 𝑚 = 201) equally
spaced points 𝑡𝑖 over the interval [-1 1], then the total square-error would be the
sum
201
2
𝐸 = ∑ (𝑓 (𝑡𝑖 ) − 𝑓̃(𝑡𝑖 ))
𝑖=1
Solve for the set of parameters {𝑎0 , 𝑎1 , 𝑏1 , 𝑎2 , 𝑏2 } that minimize the error function
𝐸(𝑎0 , 𝑎1 , 𝑏1 , 𝑎2 , 𝑏2 ) and compare your solution to the LSE solution.
Hint: Formulate the problem as a linear regression problem and solve the resulting
overdetermined system of linear equations employing the pseudo-inverse method.
Refer to the Section “General Linear Least-Squares Regression and the Polynomial
Model” in Lecture 18 of the course ECE 3040:
http://neuron.eng.wayne.edu/auth/ece3040/lectures/lecture18.pdf