Math 202 FSweek 10
Math 202 FSweek 10
Math 202 FSweek 10
We now study the response of differential equations to periodic inputs. A periodic function
is one which repeats itself perfectly with a fixed frequency. That is, there is a period p such
that
f (t + p) = f (t), ∀t.
f (t)
f (t)
t
t 1p t + p 2p 3p
We will see how all such functions can be expressed in terms of sines and cosines.
f (t) = t2 − 1, t ∈ [−1, 2)
f (t)
−1 2 5 8 11
Example 27.2 The function f (t) = eiω t is periodic with p = 2π/ω since
ω 2π
f (t + p) = eiω (t+2π/ω) = ei (ω t+ ω
)
= ei ω t ei 2π = eiω t 1 = f (t).
In general, a signal with frequency cHz has period 1/c and angular frequency 2π c.
1
Example 27.3 The function f (t) = sin(2t) − 2 cos(3t) is periodic.
Solution. The component sin(2t) repeats every time t is increased by π, so that component
has period π. The component cos(3t) repeats every time that t is increased by 2π/3, so that
component has period 2π3
. The combination of the two cycles repeats when time is increased
by a p which is a multiple of both π and 2π
3
. The least such multiple is 2π, so the period is
2π, the fundamental frequency is c = 1/2πHz.
Putting these two together, every time t is increased by 2π, the sine component has undergone
three complete cycles, and the cosine component has had two complete cycles. Thus, the
period is 2π, the frequency is c = 1/2πHz and the angular frequency is ω = 1.
1π 2π 3π 4π
2 cos(3t)
sin(2t)
t
Notice that the function f is built of just two repeating sinusoidal functions, yet exhibits a
more complex waveform.
The fundamental frequency is the greatest common divisor of all the frequencies in the sig-
3
nal; in this case, the two frequencies are 2π and π1 , and these other frequencies are harmonics.
2
28 Representing a periodic function
Recall the square wave
As n alternates between even and odd integers, the values flips between 1 and −1. This
function has period 2π.
f (t)
2π 4π 6π
When the DE
y 00 + k 2 y = f (t)
is subject to square wave forcing, resonance is seen for odd integers k. We will now see why.
Then
Z ∞
L {f (t)} = e−st f (t) dt
Z0 p Z 2p Z 3p
−st −st
= e f (t) dt + e f (t) dt + e−st f (t) dt + · · ·
0 p 2p
∞
X Z (n+1)p
= e−st f (t) dt.
n=0 np
On each of these intervals the periodicity of f can be exploited. Make the substitution
τ = t − np so that
Z (n+1)p Z p Z p
−st −s(τ +np)
e f (t) dt = e f (τ + np) dτ = e−sτ (e−sp )n f (τ ) dτ.
t=np τ =0 | {z } 0
=f (τ )
3
Then, returning to the calculation,
∞ Z
X (n+1)p
L {f (t)} = e−st f (t) dt
n=0 np
X∞ Z p
= e−sτ (e−sp )n f (τ ) dτ
n=0 0
Z p
= e−sτ f (τ ) dτ (e−sp )n
Z0 p
1
= e−sτ f (τ ) dτ .
0 1 − e−sp
(1 − e−sπ )
= .
s(1 + e−sπ )
This calculation is a bit painful, but we have got somewhere! We are used to Laplace transforms
that look like
c1 c2
+ + ···
s − a1 s − a2
so that
−1 c1 c2
L + + · · · = c1 ea1 t + c2 ea2 t + · · · .
s − a1 s − a2
The key to understanding the Laplace transform of the square wave is to notice that the
denominator is zero at s = 0 and whenever e−sπ = −1. Looking in the complex plane,
ez = −1 precisely when z is an odd multiple of iπ; that is, sπ = i mπ, m odd or s = i m.
Therefore, we might be expect to express the square wave as a sum of complex exponentials
X
f (t) = cm eim t .
m odd
But, by Euler’s formula, eix = cos x + i sin x, so in fact, this sum could appear as
X
square wave = am cos m t + bm sin m t.
m odd
4
Remark: the elaborate reasoning above can be done for any periodic function. Recall that
Z p
1
L {periodic f } = e−sτ f (τ ) dτ.
1 − e−s p 0
In this case, the LT has zeros in the denominator whenever sp = i 2nπ, so f might be
represented as a sum of
2nπt 2nπt
cos and sin .
p p
sin t, sin 3t, sin 5t, · · · , cos t, cos 3t, cos 5t, · · · .
f (t)
errors
t
t
2π
2π
Left: square wave with several candidate sin components; Right: errors
Suppose we choose b to make b sin t the best fit to the square wave f . To do this, we are
going to make
|b sin t − f (t)|
as small as possible. However, it is not clear what the best choice of b is! We can make a
good fit at some points with a suitable choice of b, but then it doesn’t work well at other
points. A clean approach is obtained by trying to minimize the mean square error. That is,
we choose b to make Z 2π
(b sin t − f (t))2 dt
0
as small as possible. To this end, expand
Z 2π Z 2π
2
(b sin t − f (t)) dt = [(f (t))2 − 2 f (t) b sin t + b2 sin2 t] dt
0
Z0 2π Z 2π Z 2π
2 2
= (f (t)) dt − 2 b f (t) sin t dt + b sin2 t dt.
0 0 0
5
To minimize, we try differentiating and setting to 0:
d 2π
Z Z 2π Z 2π
2
0= (f (t) − b sin t) dt = 0 − 2 f (t) sin t dt + 2 b sin2 t dt.
db 0 0 0
Then, R 2π
0
f (t) sin t dt
b= R 2π 2 .
0
sin t dt
Finally, we have something to compute!
Z 2π Z π Z 2π Z 2π
f (t) sin t dt = (1) sin t dt + (−1) sin t dt = 4 and sin2 t dt = π.
0 0 π 0
f (t)
2π
6
29 Orthogonal expansion and real Fourier Series
Recall: when describing vectors in three dimensions we have
r = (x, y, z)
The three vectors {e1 , e2 , e3 } = {(1, 0, 0), (0, 1, 0), (0, 0, 1)} have the special property that
they are an orthogonal basis for R3 . In Euclidean space, orthogonality is defined via the
dot product
u · v = (u1 , u2 , . . . , um ) · (v1 , v2 , . . . , vm ) = u1 v1 + u2 v2 + · · · + um vm
v = c1 e1 + c2 e2 + · · · + cm em
• ei · ej = 0 (unless i = j).
Key idea: the representation of v in terms of the basis elements is very easy to obtain when
the basis is orthogonal. This is codified in the following theorem.
v · ej = (c1 e1 + c2 e2 + · · · + cm em ) · ej = c1 e1 · ej + c2 e2 · ej + · · · + cm em · ej .
Now, all of the terms ei · ej = 0 except when i = j, so this expression actually becomes
v · ej = 0 + 0 + · · · + 0 + cj ej · ej + 0 · · · + 0;
7
We use this idea to express periodic functions in terms of some special basis.
First, we need a notion of what it means for two period-p functions to be orthogonal.
Definition. Functions, f, g : [0, p) → R are orthogonal if and only if
Z p
f (t) g(t) dt = 0.
0
Example 29.2 Let f (t) = t (1 − t) and g(t) = t + c be defined on [0, 1). Choose a value of
c so that f and g are orthogonal.
Solution.
Z 1 Z 1
f (t) g(t) dt = t (1 − t) (t + c) dt
0 0
Z 1
= (t2 − t3 + ct − ct2 ) dt
0
1
c 2 1 − c 3 t4
= t + t −
2 3 4 t=0
c 1−c 1
= + +
2 3 4
c 1
= + .
6 12
Hence, when c = −1/2, f and g are orthogonal; otherwise, they are not.
f (t)g(t)
c = 1/2
c=0
t
c = −1/2
1
c = −1
When c = −1/2 positive area between f (t)g(t) and the t axis balances negative area.
Example 29.3 Show that sin 2 t and cos 3 t are orthogonal over [0, 2π).
Z 2π
1 2π
Z
sin 2t cos 3t dt = [sin(2t + 3t) + sin(2t − 3t)] dt
0 2 0
t=2π
1 −1
= cos 5t + cos t
2 5 t=0
1
= [(−1/5 + 1) − (−1/5 + 1)] = 0.
2
Exercise: Show that sin m t, sin nt, cos pt, cos qt are mutually orthogonal over [0, 2π) unless
m = n, p = q.
8
Rp
If we let 0 f (t) g(t) dt replace the dot product in Theorem 29.1, and {e1 (t), e2 (t), . . . , em (t), . . .}
be an orthogonal basis then
Rp Rp Rp
0
f (t) e1 (t) dt 0
f (t) e2 (t) dt f (t) em (t) dt
f (t) = R p e1 (t) + R p e2 (t) + · · · + R p0 em (t) + · · · .
0 1
e (t) e1 (t) dt 0 2
e (t) e2 (t) dt 0 m
e (t) em (t) dt
Remark: Similar to the above exercise, it is easy to show that the given set is orthogonal. To
show that it is a basis requires a proof of completeness, which is beyond the scope of this
course.
We can take the set of basis functions to be {1, cos 2nπt
p
sin 2nπt
p
}∞
n=1 . Direct calculations give
Z p 2 Z p 2
2πnt p 2πnt p
sin dt = and cos dt = .
0 p 2 0 p 2
where
2 p
Z
2π n t
an = f (t) cos dt
p 0 p
Z p
2 2π n t
bn = f (t) sin dt
p 0 p
Note: because of periodicity, the integrals in f can be computed over any interval of length
p. For example, if p = 2π the integral limits could be taken as 0 and 2π, or −π and π, or 1
and 1 + 2π — use whatever is most convenient and think about why it works!
Finding the coefficients an , bn is called analysis. [a0 is the “DC component” – why? ]
Recovering the function f as the sum is called synthesis. This sum is the Fourier series.
9
Example 29.4 (Triangular wave) The function f (t) = |t|, defined on [−1, 1] is repeated
periodically with period p = 2. Here, we have a couple of choices of how to set up the integrals.
The obvious two are [−1, 1] and [0, 2]. For this example, we’ll use the former choice.
f (t)
t
−1 1 2 3 4
Note: The graph shows that f is an even function (symmetric about t = 0). This means
that we might expect the Fourier series to be symmetric too, so perhaps will contain cosines
(because these are even), but not sines.
Solution. We will set up the integrals over the interval [0, 2], so
2 1
Z Z 1
2πn t
an = f (t) cos dt = f (t) cos πn t dt
2 −1 2 −1
and Z 1 Z 1
2 2πn t
bn = f (t) sin dt = f (t) sin πn t dt.
2 −1 2 −1
Next, Z 1 Z 0 Z 1
an = f (t) cos nπt dt = (−t) cos nπ t dt + t cos nπ t dt. (†)
−1 −1 0
10
Both integrals require a similar integration by parts calculation:
Z Z
1 1
t cos nπt dt = t sin nπt − 1 sin nπt dt
nπ nπ
1 1 − cos nπt
= t sin nπt −
nπ nπ nπ
1 1
= t sin nπt + cos nπt.
nπ (nπ)2
Hence
Z 0 0
1 1
(−t) cos nπ t dt = − t sin nπt + cos nπt
−1 nπ (nπ)2
−1
1 1 1 1
=− (0) sin(0) + cos(0) − − (−1) sin(−nπ) + cos(−nπ)
nπ (nπ)2 nπ (nπ)2
(−1)n
1
=− 0+ + 0+
(nπ)2 (nπ)2
1
= [−1 + (−1)n ]
(nπ)2
−2
(nπ)2
n odd
=
0 n even
Beyond the DC term, the first term in the Fourier series is of the form cos πt with frequency
c = 1/2 (angular frequency π). This is the fundamental frequency for this signal. The
other frequencies, at odd multiples of c, are the harmonics.
R2
Exercise.
Repeat the analysis step for the previous example using integrals 0
and
t t ∈ [0, 1)
f (t) = . Verify that exactly the same coefficients are obtained.
2 − t t ∈ [1, 2].
11
Even and odd functions
A function is odd if g(−t) = −g(t) (if you flip in the t = 0 axis, the function turns upside
down). This means that any area between the graph of g and the t-axis for t < 0 has the
opposite sign of the corresponding area with t > 0. An immediate consequence is that integrals
R p/2
of odd functions over symmetric intervals are always 0: −p/2 g(t) dt = 0.
If f is odd, then f × cos is also odd, so there are no cosine terms in the Fourier series for an
odd function.
Similarly, g is even if g(−t) = g(t). If f is even then f × sin is an odd function, and there
are no sine terms in the Fourier series of an even function.
This reasoning can be pushed further, for if g is even then areas to the left of t = 0 are
R0 R p/2
exactly the same as for t > 0: −p/2 g(t) dt = 0 g(t) dt. This can simplify calculations of
the non-vanishing Fourier coefficients.
Rectification
The function max{f (t), 0} is called half-rectified, and any negative values are replaced with
0. The function |f (t)| is fully-rectified.
12