Click here to go to the applet.

This java applet demonstrates Fourier series, which is a method of expressing an arbitrary periodic function as a sum of cosine terms. In other words, Fourier series can be used to express a function in terms of the frequencies (harmonics) it is composed of.

To select a function, you may press one of the following buttons: Sine, Cosine, Triangle, Sawtooth, Square, and Noise. The function is displayed in white, with the Fourier series approximation in red. If you only see a red graph, that means the Fourier approximation is nearly the same as the original function. (The red graph is drawn on top of the white one.)

Below the function you will see a graph of the Fourier coefficients. Each one represents a frequency, or harmonic. There are two sets of terms; on top are the sine terms, and on the bottom are the cosine terms. Low frequencies are on the left and higher frequencies are on the right.

The "Number of Terms" slider will adjust the number of terms in the expansion. The more terms there are, the better the approximation. Try sliding the "Number of Terms" slider from left to right slowly to see the Fourier terms added up one by one.

If you move the mouse over one of the harmonics, it will turn yellow, and the corresponding Fourier term (frequency) will be drawn on top of the function in yellow. So if you move the mouse over all the harmonics, you can see each of the terms individually. Also, if you click with the right mouse button on one of the harmonics, the "Number of Terms" slider will be changed so that all higher-frequency terms will be taken out of the series.

You can modify the function in one of two ways. You can edit the function directly by clicking on it; in this case, the Fourier coefficients will be regenerated when you are done. Or, you can modify the Fourier coefficients, in which case the function will be changed to match. If you want to create a function from scratch, hit the "Clear" button.

The "Clip" button can be used to simulate clipping. It will increase the amplitude of the function, but will clip it if it goes out of range. Try doing this with a sine function. Using this button generally results in more jagged edges, which means more high-frequency terms will be involved in the expansion. Some functions, like the square wave, aren't affected much by clipping.

The "Resample" button can be used to demonstrate aliasing. The function is replaced with samples at 32 points. In almost all cases this will cause aliasing, where new, unwanted frequencies will be introduced. Press the "Resample" button multiple times to choose a lower sampling rate.

When the "Quantize" button is pressed, the values in the function are rounded off to the nearest multiple of 1/8. The resulting roundoff error causes new frequencies to be introduced. This is called quantization distortion. Press "Quantize" multiple times to use a coarser quantization.

The "Rectify" button will zero out the function wherever it is negative. The "Full Rectify" button will take the absolute value of the function at all points. Try this with the sine or sawtooth function.

The "Mag/Phase view" checkbox will allow you to view the Fourier terms in phase-angle form (see this page for more on this representation).

Other things to try:

Click here to go to the applet.



java@falstad.com