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

Notes 07. Fourier Series Errors

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 7

7.

Error in Fourier Series


Nurgun Erdol
10Feb09
In the last section, we studied the Fourier series expansion of a rectangular wave which is also
called a square wave even when it is not square. We obtained the Fourier series coefficients
analytically using integrals; and we verified the results numerically by building the rectangular
signal from the harmonics in the Fourier series. The first five of these are shown in Figure . The
first row figures are identical, because they both show the !" term, equal to a constant given by
the coefficient
o
a
. It is also the signal#s $ero%order approximation. The second row shows the first
harmonic in the left column. &ote that it has a period of ' which is the period of the signal. The
second column is the first%order approximation which is the sum of the two harmonics. Third
row#s left column shows the third harmonic, and the right column shows the sum of the three
harmonics shown. &ote that the third harmonic has a period that is () of that of the first
harmonic and hence its frequency is three times that of the first. I s*ipped the second one
because it is $ero. +,lease chec* the preceding set of notes.- The last row shows the seventh
harmonic on the left and the seventh%order approximation on the right. We can already see a
rectangular shape forming.
-4 -2 0 2 4
-2
0
2
Harmonics of the Square Wave in Example 4
-4 -2 0 2 4
-2
0
2
The approximations of the Square Wave in Example 4
-4 -2 0 2 4
-0.5
0
0.5
-4 -2 0 2 4
0
0.5
1
-4 -2 0 2 4
-0.2
0
0.2
-4 -2 0 2 4
0
0.5
1
-4 -2 0 2 4
-0.1
0
0.1
-4 -2 0 2 4
0
0.5
1
-4 -2 0 2 4
-0.1
0
0.1
time (s)
-4 -2 0 2 4
0
0.5
1
time (s)

Figure 1. Approximations (right column) and their associated harmonics (let column) obtained rom the
Fourier series o a s!uare "a#e.

In Figure ' and Figure ) are displayed the square wave and its third and seventh order
approximations superimposed on the same set of axes. The red ones are the approximations and
the one in Figure ) is $oomed in for visibility. What you should notice is a- the seventh
approximation is closer to the square wave at most points than the third approximation, b- the
value of both approximations +third and seventh order- at the edges of the square wave, e.g. at
( ',( ', )( ' etc t =
stays the same and it stays at ., and c- the maximum deviation of the
approximations from the square wave aren#t changing. /ou can observe these better on many
more approximations by running the m%file called Notes0$ExerciseNo%&&and&'and'.m. 0
discussion of these observations is next.

-4 -3 -2 -1 0 1 2 3 4
-0.2
0
0.2
0.4
0.6
0.8
1
time (s)
Square wave and its third order approximation
Figure (. )he s!uare "a#e and its third order approximation (in red).
-0.5 0 0.5 1 1.5 2 2.5
-0.2
0
0.2
0.4
0.6
0.8
1
time (s)
Square wave and its seventh order approximation
Figure *. S!uare "a#e and its se#enth+order approximation (in red).
'
Approximation Errors
The Fourier series equates a periodic function to a sum of sinusoids according to the
equation

+ - cos+' - sin+' -
o n o n o
n n
x t a a nf t b nf t

= =
= + +

.
1ne can always question an assertion li*e that, so Fourier had to prove that indeed the right hand
side +234- is 5equal6 to the left hand side +734- for any
+ - x t
that satisfies the !irichlet
conditions given in Notes 06. Periodic Functions and the Fourier Series.doc. 3is rigorous proof
is beyond the scope of this course. 3owever, we can intuitively and with the help of computation
touch on most of the significant points of the proof.
If ( ) + - 8.9cos+' : - 8.;sin ' : x t t t = + +
, then the 234 defines
+ - x t
, which means that
for every
t
, what one calculates on the 234 is what
+ - x t
is. The error, defined as the difference
of the two sides ( ) ( ) ( )
+ - 8.9cos+' : - 8.;sin ' : e t x t t t = + +
is 8 for every
t
. 3ence the
energy in the error signal is also 8. 2ecall that energy is the integral of the squared signal, which
in this case is the error. The problem becomes more difficult when for a given
+ - x t
the 234 of
has infinitely many terms, such as in this example of the square wave. In this case, the equality is
proven by studying the behavior of approximations with a finite number of terms as the number
of terms is increased to infinity. 3ence we define the N
th
order approximation to
+ - x t
as

+ - cos+' - sin+' -
N N
N o n o n o
n n
x t a a nf t b nf t
= =
= + +

which gives rise to the N
th
order approximation error
( ) + - + -
N N
e t x t x t =
.
Figure : is divided into three rows and three columns. <ach column has the same order N which
is ,) and : from left to right. The top row shows the N
th
harmonic for the square wave. It is a
cosine of frequency N . &ote that all plots are drawn for 9 9 t < < . 1ver the same duration,
the first harmonic has 9 cycles, the third harmonic has ' cycles which is ) times as many as the
first. The :
th
harmonic has '8 cycles, which is : times as many as that of the first. The second
row shows the N
th
approximation. The rectangular shape of the approximation is beginning to
emerge for &=) and loo*s closer to it for &=:. &ote that &=: has more ripples +) in per on%
cycle around and ) in the off cycle around 8- than the third order approximation which has '
and the first order which has . The ripples may be seen in the last row where the error
+ -
N
e t
is
plotted.
To evaluate the error, and to see the changes in it, I have plotted them in Figure : over a
shorter duration and for
, ), :, >, ? N =
. 7et#s first focus on the values at 8 t = where ( ) x t =
.
+8- 8.)@@, 8.8>:@, 8.8:>, 8.8)?', 8.8):.
N
e =
for
, ), :, >, ? N =
. 1ne can deduce, of course
observing data for many more values of &, that
lim +8- 8
N
N
e

=
, that is the error at 8 oscillate
around 8 but getting closer and closer to it with each &. &ow let#s do the same for 8.' t = and
)
-4 -2 0 2 4
-1
-0.5
0
0.5
1
time (s)
Harmonic number 1
-4 -2 0 2 4
-0.5
0
0.5
1
1.5
1-th order approximation
time (s)
-4 -2 0 2 4
-1
-0.5
0
0.5
1
The 1-th order approximation error signal
time (s)
-4 -2 0 2 4
-0.4
-0.2
0
0.2
0.4
time (s)
Harmonic number 3
-4 -2 0 2 4
-0.5
0
0.5
1
1.5
3-th order approximation
time (s)
-4 -2 0 2 4
-1
-0.5
0
0.5
1
The 3-th order approximation error signal
time (s)
-4 -2 0 2 4
-0.2
-0.1
0
0.1
0.2
time (s)
Harmonic number 5
-4 -2 0 2 4
-0.5
0
0.5
1
1.5
5-th order approximation
time (s)
-4 -2 0 2 4
-1
-0.5
0
0.5
1
The 5-th order approximation error signal
time (s)
Figure ,. For approximation orders 1- * and .(rom let to right) are sho"n a) the harmonics (top ro")-
b)approximations ( )
N
x t (second ro") and c) approximation error signal ( )
N
e t (third ro") is the dierence
bet"een the s!uare "a#e and the second ro".
and 8.; t = . The numbers are little different but we still deduce that
lim + - 8
N
N
e t

=
for 8.' t = and
8.; t = . The picture changes at 8.: t = , which is a point of discontinuity of ( ) x t
. When you
approach the discontinuity from the right, you get % for all &. It doesn#t change. When you
approach the discontinuity from the left, you get and it doesn#t change with &, either. &ow if
you switch your attention to Figure @, you see that the approximation ( )
N
x t
is always 8.: at
t=8.:. This explains the behavior of the error signal. 0lso observe in Figure @, that the maximum
over 8 8.: t < < of ( )
N
x t
is at t=8 for N=, and moves to
8.':, 8.)), 8.)?, 8.9 t =
for N=),:,>,?.
that is to say that the pea* migrates toward the location of the discontinuity. This is one more
observation that as ( ) ( ) as
N
x t x t N
for all
t
that does &1T support a discontinuity. 0t
points of discontinuity of the square wave function of this example, ( ) 8.:
N
x t =
for all N. 4ince
the sustained error is of finite value equal to 8.: and only occurs at isolated points, its
contribution to the total error energy is 8. 2emember the error energy per cycle is the integral of
( )
'
N
e t
over period.
9
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
-0.5
-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0.4
0.5
time (s)
Approximation error signals orders 1,3,5,7,9


order 1
order 3
order 5
order 7
order 9
Figure .. Approximation errors o odd orders 1 through 9 displa/ed or one period.
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
time (s)
Approximation signals of orders 1,3,5,7,9


order 1
order 3
order 5
order 7
order 9
Figure $. Approximations o orders 1-*-.-7-9 to the s!uare "a#e signal.
:
The mean%square error +mse- is equal to the error energy divided by the period. It can be
approximated numerically by the sum of the square of the error signal at samples over a period.
The mse of the error specified as a function of the continuous variable t is given by the integral
( )

'

'
N N
e t dt

.
1f course equation is for the square wave we are analy$ing and the limits will change and factor
of . will be replaced with (T for other examples where T is the signal period. The
computational approximation to may be given by
( ) ( )
'

'
M
N N k
k M
t e t
=


where the samples ( )
k
t k t =
and ( ) ( M t =
if it is an integer. <quation is derived from a
representation of ( )
'
N
e t
in terms of rectangles that are t wide and are of height equal to ( )
'
N k
e t
.
Asing ( ) M t =
, it is easy to show that <quation may be written as
( )
'

'
M
N N k
k M
e t
M


.
The 234 of <quation is plotted for the example square wave and shown in Figure >. the figure
shows that the mse goes to 8 as N gets large.
0 10 20 30 40 50 60
0
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
0.045
0.05
mean-square error
Harmonic number
Figure 7. 0ean+s!uare error computed or the s!uare "a#e or N11 to .1.
@
Summar/ o errors
4pecific data refer to the square wave example. 0ll others are general.
. ,oint%wiseB The error signal goes to $ero everywhere but at the points of discontinuity.
For all
t
other than points of discontinuity +e.g. { } ( ', )( ', :( ' t K
-
( ) ( ) lim
N
N
x t x t

=
'. ,oint%wiseB 0t a point of discontinuity, there is a sustained error equal to . the difference
of the two sides of the discontinuity. The Fourier series is said to converge to the mean or
average value of the right and left limits of the discontinuity. 0t points of discontinuity,
+e.g. { } ( ', )( ', : ( ' t = K
-
( ) ( ) ( ) ( )
( )
( ) ( )
8.:
8.:
8.:, 8.:
N left right
N
N left N right
x t x t x t general
x t square wave
e t e t square wave
= +
=
= =
K
K
K
where ( )
left
x t
is the value of ( ) x t
to the left of the discontinuity and ( )
right
x t
is its value to the
right.
). The mean square error always converges to 8, i.e.
lim 8
N
N

=
>

You might also like