Discrete Fourier Transform (Forward)
This page contains a utility that computes the Fourier coefficients of a real periodic sequence (Fourier analysis.).
When data comes from an underlying phenomenon that is periodic, that data can have a Fourier Transform applied to it to determine if it can be represented by a combination of simpler cyclical functions (i.e. - sines and cosines.) If the data is generated from a function,
(i) a Fourier integral transform could be used to convert it into a pair of real functions, or
(ii) a Fourier transform could be used to convert it to a sequence of Fourier series coefficients.
If the data comes from discrete samples taken at specific time intervals, a Discrete Fourier Transform (DFT) may be used to convert the data sequence into another. That is what the program posted on this page does.
For example, say we have collected the following data points:
i) N = 8 (the number of data points).
ii) The data has been sampled at uniform time intervals (every 1/7 time unit). The program posted on this page assumes the data entered corresponds to a uniform sampling rate.
iii) The first point was sampled at t = 0. If the first point did not correspond to t = 0, the program still works, but the output would have to be adjusted appropriately.
If the user has control over the number of data points that are going to be analyzed via this DFT (perhaps data is generated by a user-written computer program), it is recommended--but not required--that N be a power of 2:
22 = 4
23 = 8
24 = 16
25 = 32
When N is a power of 2, certain processes in the program can run more quickly.
The program posted on this page accepts only the gi values as input:
The corresponding time values should not be entered.
The DFT program then computes Fourier coefficients such that the data can be expressed in the following form:
where the upper summation limit [N/2] refers to the largest integer in N. In other words,
if N is even, [N/2] refers to N/2,
if N is odd, [N/2] refers to (N - 1)/2.
The ak and bk values are computed as follows.
If N is odd, the next two equations apply over the range 1 ≤ k ≤ [N/2].
If N is even, these two equations apply over the range 1 ≤ k < [N/2] (does not include k = N/2).
If N is even, the values for k = N/2 are found as follows:
bN/2 = 0
HOW TO USE THIS UTILITY
In the "Discrete Data Sequence" box below, enter the data sequence (real numbers.) Enter the ordinate values one per line--nothing else. No commas, periods, brackets, etc. (Also note that numbers in scientific notation are NOT recognized).
Continuing with the sample data above, the following numbers would be entered:
Once you click the "Perform DFT" button, this utility will compute and output the Fourier coefficients (the ak and bk values.) If the data just above is entered, the following results should be output:
The ak values follow:
azero = 0
The bk values follow:
For more information about this program, please see the associated blog post: Discrete Fourier Transform Blog Post