Hover over the menu bar to pick a physics animation.

In this program, we show how well we can match several types of input waveforms from which we choose a limited number of sample points (nodes) and then apply a Fast Fourier Transform (FFT) to them. The FFT is often used for finding any sign of intelligent information in very noisy temporal data such as might come from outer space or in a radar signal. Here, however, we will examine how the FFT handles standard waveforms using very limited numbers of sample points or nodes. The number of nodes are limited by the FFT algorithm to powers of 2, in this case 8, 16, 32 and 64. The waveforms that can be chosen are the sine wave, the square wave, the trianglular wave, and the sawtooth wave. To each of these waves we may apply an asymmetry factor, asymm. asymm is the percent by which the wave has imperfect asymmetry. For example, for the sine wave, asymm gives the percent of the wave's abscissa taken up by the positive lobe. The FFT yields both a real (re) and imaginary (im) part for each resulting frequency fn. These result in both an amplitude

`A_n=sqrt(re*re+im*im)`

and a phase

`phi_n=tan2^-1(im,re)`

`g(n,t)=A_ncos(2*pif_nt+phi_n)`

The total number of different frequencies, fn, available from the FFT is equal to the number of nodes. The first nNodes/2 frequencies are positive and the second nNodes/2 frequencies are negative. The lowest non-zero frequency is `1/T` where `T` is the number of nodes sampled for the wave. Higher frequencies are `n/T`.
Four different plots are provided:

Blue: The original waveform

Green: The amplitudes of the Fourier components. These are discrete so just spikes are shown to show An. At the top of the spike, the frequency number, `n`, is shown as well as an arrow that shows the phase. When the phase is zero, the arrow points to the right. For positive phases the arrowhead is in the upper two quadrants and for negative phases are in the lower two quadrants.

Black: Plots of the first `(nNodes)/2` Fourier components using their frequencies and phases. This is shown only if the "Show Components" checkbox is checked.

Red: A plot of the sum of all of the Fourier components.

The plots are normalized to the same total heights as the original wave. The learner should note that the agreement of the component sum with the input waveform improves as the number of nodes increases. We can not expect a finite number of sinusoidal waves to replicate input waveforms which have discontinuities in their slope. This is epecially true for the square wave whose VALUES have a discontinuity, resulting in an overshoot anomaly which exists even for an infinite number of nodes. This anomaly is called the Gibbs anomaly.