Supplementary Notes on Fourier Series, DFT and FFT
Continuous functions defined in terms of cos and sin
Consider a function of the form where and are constants. The value is the period of the function.
> |
> |
(1) |
Set to the following values.
> |
(2) |
> |
> |
Remarks
Next consider a function of the following form which has two terms.
> |
> |
(3) |
where and where the period is .
> |
(4) |
> |
(5) |
> |
(6) |
> |
> |
Let us look at the terms making up the sum.
> |
(7) |
> |
(8) |
> |
(9) |
> |
> |
Remarks
> |
> |
> |
Remarks
> |
Below is a table of the individual plots and the combined plot.
> |
|
|
Three plots
|
|
Orthogonality Properties of cos and sin
> |
We are interested in representing in terms of a sum of trig functions as follows:
where the coefficients and are to be determined from the function .
For simplicity, suppose that the function is defined for , with period so will be represented in the following form.
> |
(10) |
> |
The following orthogonality properties allow us to determine formulas for and in terms of integrals involving .
> |
> |
> |
(11) |
> |
(12) |
> |
(13) |
> |
(14) |
> |
(15) |
> |
(16) |
We will also need the values
> |
(17) |
> |
(18) |
By exploiting these orthogonality properties, we can derive a formula for each and .
> |
The formula for a0
Recall equation (10).
> |
(19) |
On both sides of this equation, integrate over .
> |
(20) |
> |
(21) |
From this equation we immediately get the formula for
> |
(22) |
> |
The formula for aK (K > 0)
Recall equation (10).
> |
(23) |
> |
On both sides of this equation, multiply by and then integrate over . All of the terms on the right hand side integrate to zero except for one term, namely the term from the first summation when yielding:
> |
(24) |
From this equation we immediately get the formula for .
> |
(25) |
> |
The formula for bK (K > 0)
Recall equation (10).
> |
(26) |
On both sides of this equation, multiply by and then integrate over . All of the terms on the right hand side integrate to zero except for one term, namely the term from the second summation when yielding:
> |
(27) |
From this equation we immediately get the formula for .
> |
(28) |
> |
Example: Computing Fourier Series Coefficients
Consider the following continuous function.
> |
> |
(29) |
> |
> |
Compute some of the Fourier coefficients of .
Note: In the following, we use Maple's inert operator and then we invoke numerical integration by applying .
> |
(30) |
> |
(31) |
Compute and store the Fourier coefficients up to .
> |
Compute and store the partial sums of the Fourier series for .
> |
Display plots of (in blue) superimposed on the plot of the original function (in red).
> |
> |
When we see that the Fourier series approximation matches the original function very well.
We can use the Maple command to do "floating point normalization", meaning to round the numbers to a specified number of digits and to set to zero any values that are small relative to the number of digits specified.
For example, suppose that we are interested in 4 digits of accuracy.
> |
(32) |
> |
(33) |
> |
(34) |
Apply to decrease the number of terms in .
> |
(35) |
> |
(36) |
> |
(37) |
We have decreased the number of terms in from to while retaining 4 digits of accuracy.
> |
> |
Complex exponential form
As a more compact representation for Fourier series, we choose to use complex exponential form, based on the well-known relationships:
> |
> |
(38) |
> |
(39) |
or
> |
(40) |
> |
(41) |
The complex exponential form for the Fourier series is
> |
(42) |
and by using orthogonality properties for complex exponentials similar to the case of and , one can show that
> |
(43) |
> |
The correspondence between the coefficients and the coefficients , in the - representation is as follows:
for ", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "fal..." align="center" border="0"> .
We will see that in applications, we are most interested in the relative magnitudes of the coefficients corresponding to various frequencies . Note that
and .
In typical applications, there is a small amount of information in the high-frequency terms. In other words, the coefficients will be very small in magnitude for large . Therefore, it is reasonable to truncate to a finite summation:
> |
(44) |
for some integer .
> |
Discrete Fourier Transform (DFT)
Analogous to the continuous Fourier series discussed above, we define the Discrete Fourier Transform (DFT) as follows.
> |
> |
(45) |
> |
(46) |
> |
> |
The Vandermonde system is
> |
(47) |
> |
> |
> |
(48) |
> |
(49) |
> |
(50) |
> |
(51) |
> |
> |
Fast Fourier Transform (FFT)
> |
> |
Forward FFT:
Define .
Then
Inverse FFT:
With defined as above,
.
Example:
> |
(52) |
> |
(53) |
> |
(54) |
> |
(55) |
Forward FFT:
> |
(56) |
Check that the Inverse FFT recovers the original data values:
> |
(57) |
> |
(58) |
> |
(59) |
> |
(60) |
> |
Cost Analysis of FFT
Note that the cost function counting the number of arithmetic operations for procedure FFTeval satisfies the following recurrence equation.
> |
> |
(61) |
Here, is left as an arbitrary constant. The term represents the fact that in addition to the two recursive calls, there are additional arithmetic operations.
Maple can solve this recurrence equation:
> |
(62) |
This shows that procedure FFTeval costs to evaluate a polynomial of length at the roots of unity. Note that is simply to the base , and two such logarithms are equivalent up to a constant factor. In fact, the logarithmic term showing up here is precisely :
> |
(63) |
It follows that both the Forward FFT and the Inverse FFT cost .
> |