Periodic Functions: Computing Coefficients
Periodic Functions: Computing Coefficients
Fourier Series*
* Adapted from notes originally prepared by
Dr. G. V. Smith.
A0
t
t
+ An cos 2n + Bn sin 2n
2 n=1
T
T
where
An =
2
t
f ( t ) cos 2n dt
T 0
T
Bn =
2
t
f ( t ) sin 2n dt
T 0
T
Simplifications
Computing Coefficients
Even Function
f ( t ) = f ( t ) Odd Function
Trapezoidal Rule
A simple way to evaluate the definite integral
T
I = g ( t ) dt
0
g = g ( t1 ) g ( t 2 ) ! g ( t K ) = g1
g2 ! gK
f = f1 f2 ! fK
g ( t ) = f ( t ) cos 2n
T
t
h ( t ) = f ( t ) sin 2n
I = trapz ( t, g )
5
Coefficients - 2
Coefficients - 3
t = t1 t 2 ! t K
g = f1 cos 2n
and
Coefficients - 1
f2 cos 2n !
fK cos 2n
An = trapz ( t, g )
Bn = trapz ( t,h )
t = t1 t 2 ! t K
h = f1 sin 2n
f2 sin 2n !
fK sin 2n
Matlab Codes
Sample Function
0,
0 t 0.5
0,
1.5 t 2
(Boulet)
(Smith)
10
One Period
Four Periods
11
12
Coefficients
14
Two Terms
Three Terms
15
16
Four Terms
Six Terms
17
18
Fifteen Terms
19