0% found this document useful (0 votes)
17 views

Periodic Functions: Computing Coefficients

The document discusses Fourier series and their use in representing periodic functions. A Fourier series decomposes a periodic function into a sum of sinusoids with different frequencies. The coefficients for the sinusoids can be determined by computing integrals of the function over one period. For a sampled function, the integrals are approximated numerically using the trapezoidal rule. Matlab code is provided to demonstrate computing the Fourier series coefficients for a sample periodic function and reconstructing the function using different numbers of terms.

Uploaded by

Ricky Emeott
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Periodic Functions: Computing Coefficients

The document discusses Fourier series and their use in representing periodic functions. A Fourier series decomposes a periodic function into a sum of sinusoids with different frequencies. The coefficients for the sinusoids can be determined by computing integrals of the function over one period. For a sampled function, the integrals are approximated numerically using the trapezoidal rule. Matlab code is provided to demonstrate computing the Fourier series coefficients for a sample periodic function and reconstructing the function using different numbers of terms.

Uploaded by

Ricky Emeott
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Periodic Functions

Fourier Series*
* Adapted from notes originally prepared by
Dr. G. V. Smith.

A function that is periodic over some period T


can be represented by a Fourier series:
f (t ) =

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

The Fourier series can be simplified by choosing the


origin so that the periodic function is either even or
odd.
f ( t ) = f ( t )

Even Function

f ( t ) = f ( t ) Odd Function

For an even function, all sine terms in the Fourier


series are zero.
For an odd function, all cosine terms in the Fourier
series are zero
3

If f is a known function of time, then the coefficients


can usually be found by analytical integration.
However, often f is not known but is represented by
a discrete set of measurements. In this case
numerical integration is necessary to determine the
coefficients.

Trapezoidal Rule
A simple way to evaluate the definite integral
T

I = g ( t ) dt
0

is to use the trapezoidal rule. For the data set


t = t1 t 2 ! t K

g = g ( t1 ) g ( t 2 ) ! g ( t K ) = g1

g2 ! gK

the integral can be approximated with the Matlab


command

Consider the case where the periodic function f ( t ) has


been sampled over a period and the following data are
known.
t = t1 t 2 ! t K

f = f1 f2 ! fK

The integrands in the formulas for the coefficients of the


cosine and sine terms (slide 2) are
t

g ( t ) = f ( t ) cos 2n

T
t

h ( t ) = f ( t ) sin 2n

I = trapz ( t, g )
5

Coefficients - 2

Coefficients - 3

Then the data sets for the integrals are

The coefficients can then be computed with

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

f ( t ) = 1 sin 2 ( t 0.25 ) , 0.5 t 1.5

0,
1.5 t 2

(Boulet)

(Smith)

10

One Period

Four Periods

11

12

Coefficients

Note that because the function is even, the sine coefficients


are essentially zero.
13

14

Two Terms

Three Terms

15

16

Four Terms

Six Terms

17

18

Fifteen Terms

19

You might also like