Piecewise Linear

Fourier Series Expansion of Piecewise Linear Periodic Functions

This program computes Fourier series expansions on those functions f (X) which are piecewise-linear.   In this instance, the Fourier coefficients can be computed in closed form, segment by segment. Since the need for numerical integration is therefore eliminated, this program will run much more quickly than the general form for Fourier series expansions.

Program Notes

The maximum number of coefficients that can be computed is currently set to 10. To modify the
program, alter the DIM statements as follows.

DIM A(N)

DIM,B(N)

where N is the new number of coefficients

 

Downloads:

basic program (liberty basic) lbfsep.bas

Test Case:

F0URIER SERIES EXPANSION OF
PIECEWISE LINEAR PERIODIC FUNCTIONS

FUNCTION PARAMETER INPUT

PERIOD = 1

NUMBER OF SEGMENTS = 1

DESIRED NUMBER OF
TERMS IN EXPANSION = 5


ENTER VERTEX COORDINATES

X , F(X)
(IN ORDER OF INCREASING X)

VERTEX 1
X = 0
F = 0

VERTEX 2
X = 1
F = 1

'F0URIER COEFFICIENTS
********************

>N = 0   W=0

A = 1

N = 1W = 6.28318531W/TW0PI = 1
A = 0  B = -0.31830989

N = 2W = 12.5663706W/TW0PI = 2
A = 0  B = -0.15915494

N = 3W = 18.8495559W/TW0PI = 3
A = 0  B = -0.1061033

N = 4W = 25.1327412W/TW0PI = 4
A = 0  B = -0.79577472e-1

N = 5W = 31.4159265W/TW0PI = 5
A = 0  B = -0.63661977e-1