This is a demonstration of Discrete Fourier Transforms (DFTs). A DFT converts an array of data points (indexed by t) into an equal-length array of frequency amplitudes (indexed by s), or vice versa.
The initial array for this demonstration is a sequence of 1024 0s and 1s, with successive 1s starting at t = offset spaced period apart. The data points are then scaled (normalized) so that the sum of their squared absolute values is 1. The array is graphed at the top, with spikes for the nonzero values.
You can select the period, which will update the array using an offset picked to arrange the spikes symmetrically. You can then change the offset if you want an asymmetrical arrangement. The period and/or offset can also be specified in the querystring.
You can replace the array with its DFT or inverse DFT by clicking FwdDFT or InvDFT, respectively. The transformed array will still be normalized. With a symmetrical initial array, the transformed array will contain solely real values, but, in general, data points are complex numbers. We’ve chosen to show real values as vertical spikes, with up being positive, and complex values as oblique spikes, with leftward being the +i direction.
While a DFT is normally computed efficiently by a Fast Fourier Transform (FFT), we animate the equivalent intuitive (but much slower) computation, showing how values reinforce or interfere to fortify just those s values that correspond to frequencies present in the data. For a given s, we stretch the starting graph around a unit circle so that it wraps s times, adding up (as vectors) the spikes now spread around the circle. We show the accumulating vector sum, normalized by dividing by 32 (the square root of 1024, the number of data points), as a vector from the center. Again, +1 is up and +i is left.
Click Animated FwdDFT or Animated InvDFT to see the animation, or select an s and t to show a single frame. The sign of s indicates FwdDFT (+) or InvDFT (−). Set t to 1023 to show the fully wrapped graph.