Function
to be transformed

Fourier
Transform

This page demonstrates the use of JavaScript to perform Fourier Transforms, and DHTML to produce graphs of functions. Enter a function in terms of x in the top box. Enter minimum and maximum values for x and y in the next four boxes. Then, hit the Replot! button. If you make a mistake in entering a formula, use the Refresh feature of your browser.

Functions available in JavaScript are abs(x), acos(x), asin(x), atan(x), ceil(x), cos(x), exp(x), floor(x), log(x), max(x,n), min(x,n), pow(x,n), random(), round(x), sin(x), sqrt(x) and tan(x).

Once a function is displayed, a Fourier Transform can be performed by pressing the FFT! button. Although only 512 points are shown in the upper grapph, a Fast Fourier Transform is calculated on 1024 points from the entered function. So the Nyquist frequency for the FT is twice the apparent Nyquist frequency for the upper plot. Each of the resulting 512 real and imaginary FT points are squared and added together to produce a power spectrum. The maximum frequency, ν, and angular freqency, ω (=2πν), are displayed as determined from the maximum and mininum x values. The individual data points of the power spectrum are also listed in the lower text box. The vertical axis of the Fourier transform can be magnified by changing the value of Fmax and hitting the lower Replot! button.

Here's a good tutorial from Colby College.

Here are some interesting functions on which to perform Fourier transforms:

*sine wave*: sin(128*x)*two sine waves*: sin(100*x)+2*sin(150*x)*modulated sine wave*: sin(140*x)*sin(20*x)*modulated sine wave*: sin(100*x)*sin(120*x)*sine wave exponentially damped*: sin(128*x)*exp(-2*x)*square wave*: (sin(32*x)>0)?1:-1*sine wave pulse*: (x<0.2)?sin(128*x):0*sine of x-squared*: sin(4*x*x)*sine wave log multiplied*: sin(100*x)*log(x)*sinc function*: sin(100*x)/(100*x)*sine of an exponential*: sin(exp(x))*sine squared*: sin(x)*sin(x)-0.5- multiple pulse: sin(200*x)*(exp(-20*(x-1)*(x-1))+exp(-20*(x-3)*(x-3))+exp(-20*(x-5)*(x-5)))

For the following use, a whole number, such as 8, for x max.

*square pulse*: (x<0.1)?1:0*sawtooth*: 2*x%1-0.5*triangle*: (8*x%2<1)?8*x%1-0.5:0.5-(8*x%1)*gaussian*: exp(-(x-4)*(x-4)*1000)

Other
pages by the author. Email.

Debut: December 26, 2003. Revision No. 8.
January 4, 2013. Visitors: