Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Math 202 FSweek 10

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

MATH202 – Fourier series (notes)

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.

Example 27.1 The function

f (t) = t2 − 1, t ∈ [−1, 2)

can be repeated periodically on intervals of length 3.

f (t)

t2 − 1 repeated repeated repeated repeated

−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).

The frequency is 1/p = ω/2πHz, but the angular frequency is ω.

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

Top: graphs of the sine and cosine components of f . Bottom: graph of f .


f (t)
1π 2π 3π 4π

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

f (t) = (−1)n , t ∈ [nπ, (n + 1)π).

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.

Laplace transform of a periodic function


Suppose that f (t) = f (t + p) for every t ∈ R. The Laplace Transform requires an integral
over all of [0, ∞), and we can split this up into intervals on which f repeats:

[0, ∞) = [0, p) ∪ [p, 2p) ∪ [2p, 3p) ∪ · · · .

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

Laplace representation of a square wave


Suppose we return to the square wave. Then p = 2π and
Z p Z π Z 2π
−sτ −sτ 1
e−sτ (−1) dτ = 1 − 2e−sπ + e−s2π .

e f (τ ) dτ = e (1) dτ +
0 0 π s
Then, using the general formula,
Z p
1
L {f (t)} = e−sτ f (τ ) dτ
0 1 − e−sp
(1 − 2e−sπ + e−s2π ) 1
=
s 1 − e−s2π
(1 − e−sπ )2 1
=
s (1 − e )(1 + e−sπ )
−sπ

(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

Components of a square wave


Our reasoning above suggested that the square wave can be represented as a sum of

sin t, sin 3t, sin 5t, · · · , cos t, cos 3t, cos 5t, · · · .

Let’s have a look at how this might go.

f (t)
errors

t
t

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

Thus, the best fit of sin t to the square wave is


4
b sin t = sin t.
π
Repeating this calculation for all of the other sine and cosine terms, we find no contribution
from the cosine terms (ie, the best fit is to exclude them), and the best fit sine terms are
4 4 4 4
sin t, sin 3t, sin 5t, sin 7t, . . . .
π 3π 5π 7π
4
sin t + 13 sin 3t + 15 sin 5t + · · · .

This suggests that we might represent: square wave = π

f (t)

Note: as more terms are added, better approximations are obtained.

6
29 Orthogonal expansion and real Fourier Series
Recall: when describing vectors in three dimensions we have

r = (x, y, z)

which can be written down as

x (1, 0, 0) + y (0, 1, 0) + z (0, 0, 1).

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

and u and v are orthogonal if and only if u · v = 0.


A set {e1 , . . . , em } is an orthogonal basis for Rm if

• every vector v ∈ Rm can be written as

v = c1 e1 + c2 e2 + · · · + cm em

for some choice of constants cj , j = 1, . . . , m; and

• 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.

Theorem 29.1. When {e1 , . . . , em } is an orthogonal basis for Rm .


     
v · e1 v · e2 v · em
v= e1 + e2 + · · · em .
e1 · e1 e2 · e2 em · em

Proof. For each j,

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;

or, more simply


v · ej = cj ej · ej .
v·ej
Hence, cj = ej ·ej
and the theorem is proved.

Example 29.1 In R2 , {(1, 1), (1, −1)} is an orthogonal basis and

(2, 3) · (1, 1) (2, 3) · (1, −1) 5 1


(2, 3) = (1, 1) + (1, −1) = (1, 1) − (1, −1).
(1, 1) · (1, 1) (1, −1) · (1, −1) 2 2

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

Do not worry (yet) that this sum may be infinite.

Theorem 29.2 (Fourier basis). The set


 
2πt 2π t 4πt 4πt 6πt 6πt
1, cos , sin , cos , sin , cos , sin ,...
p p p p p p
Rp
is an orthogonal basis for the set of p periodic functions f with 0 (f (t))2 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

Therefore, the Fourier series for f is


a0 2π t 2π t
f (t) = + a1 cos + b1 sin
2 p p
2π 2 t 2π 2 t
+ a2 cos + b2 sin
p p
2π 3 t 2π 3 t
+ a3 cos + b3 sin
p p
+ ···

a0 X 2π n t 2π n t
= + an cos + bn sin
2 n=1
p p

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

The function f is defined by two pieces:



t t ∈ [0, 1]
f (t) =
−t t ∈ [−1, 0).

Hence, the integrals need to be split into two pieces.


First,
Z 1
a0 = f (t) dt
−1
Z 0 Z 1
= f (t) dt + f (t) dt
−1 0
Z 0 Z 1
= (−t) dt + t dt
−1 0
0 1
= −t2 /2 −1
+ t2 /2 0
= [0 − (−1/2)] + [1/2 − 0]
= 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

An almost identical calculation shows that


Z 1  −2
(nπ)2
n odd
t cos nπ t dt = .
0 0 n even

When the two integrals are added together from (†)


 −4
(nπ)2
n odd
an =
0 n even.

For the sine terms,


Z 1 Z 0 Z 1
bn = f (t) sin nπt dt = (−t) sin nπ t dt + t sin nπ t dt. (††)
−1 −1 0

A similar calculation, of similar length, results in bn = 0.


Finally, to synthesise, we need only carry the cosine times, since all the bn = 0:
∞  
a0 X 1 4 1 1
f (t) = + an cos nπt = − 2 cos πt + cos 3πt + cos 5πt + · · · .
2 n=1
2 π 9 25

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.

Fourier sine series


If you know that a function is periodic with period 2l, but only know its value on half its
period: [0, l), an odd extension can be made by setting
f (−t) = −f (t).
When this is done, the series is guaranteed to contain only sine terms, and

X nπt
f (t) = bn sin
n=1
l
where Z l
2 nπt
bn = f (t) sin dt.
l 0 l

Fourier cosine series


If you know that a function is periodic with period 2l, but only know its value on half its
period: [0, l), an even extension can be made by setting
f (−t) = f (t).
When this is done, the series is guaranteed to contain only cosine terms, and

a0 X nπt
f (t) = + an cos
2 n=1
l
where Z l
2 nπt
an = f (t) cos dt.
l 0 l

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

You might also like