Discrete Fourier Transform

(See info at bottom of page.)
 
        
 
 
Copyright (c) 2015-17 Dr. Edmund Weitz.
 
Code: 

This page will hopefully help you in understanding some aspects of Fourier analysis better by way of experimenting. (The application is written in JavaScript and will probably only work correctly with Chrome or Firefox.)

The upper box shows the (red) input function. You can select different input functions from the drop-down menu of the same name. For periodic input functions you can also select different frequencies. Only the part of the input function within the white rectangle (the "window") will be considered for the Fourier transform. You can move the left and right border of the rectangle using the mouse and you can also move the whole rectangle if the mouse is in its center. Use the left and right arrow keys together with the Ctrl key for more accurate positioning (of whatever was the last thing you moved with the mouse). The "Reset Window" button will bring the rectangle back to its original position.

The center box shows the input function again after being modified by a window function. You can select different window functions from the corresponding drop-down menu and will see the effect immediately. The Fourier transform will be based on a number of equidistant samples taken from the function in the center box. There's a drop-down menu to select the number of samples and if this number isn't too big, the individual sample points will be shown as small dots.

The bottom left box shows the result of a fast Fourier transform applied to the samples. (What you're actually seeing is the typical rendering of the squares of the absolute values of the complex Fourier coefficients against a logarithmic vertical scale.) Use the "Range" drop-down menu to selectively suppress small coefficients.

If you check the "Show Interpolation" box, you'll see (in green) the trigonometric polynomial computed by the Fourier transform. Apart from rounding errors this function should pass though all sample points in the center box.

Using the "Number of Samples" drop-down menu you can also add zeros to the sampled data to artificially increase the spectral resolution. (Note that a high number of samples and/or zeros can make the application seem unresponsive if you're on a slow computer. Also, display of the trigonometric polynomial will be disabled for such high numbers.)

The "Code" input function is a function determined by what you type in the "Code" input box below the copyright line. You must enter a legal JavaScript expression which depends on the variable x. Your function will be called with values of x between -π and π and should return values between -1 and 1.

If your screen is too small to accommodate all three boxes, press the "Smaller Screen" button for a smaller version of this application. (And maybe use the F11 button for full screen view.)