FFT Spectrum Analyser (arbitrary waveform function)
- Note
- This demonstration uses JavaScript together with
a Java applet. It needs a browser with both JavaScript and Java support.
The demonstration has been tested in Netscape Navigator 3.0 and 4.0 and
Internet Explorer 4.0.
This demonstration is similar to the FFT
spectrum analyser demo applet. The difference is that instead of
choosing the input signal to the spectrum analyser from a limited
selection of waveform types, you can define your own arbitrary waveform by
typing in the mathematical expression which describes the input waveform.
The waveform generator is implemented in JavaScript and the sampled values
of your waveform are passed to the Java applet, which plots the signal,
performs the FFT calculations, and plots the frequency spectrum. Note,
however, that while JavaScript offers more flexibility, it doesn't run as
fast as Java.
Outline instructions
- Select the number of samples of the input signal to be generated from
the pull-down list (or just use the default value). A larger number of
samples gives a finer spectral resolution, but it will take longer to
generate the sampled values, particularly since the waveform
calculations are done in JavaScript.
- Select the sampling rate, or use the default value of 8000 samples/s.
Keep in mind the constraints imposed by the sampling theorem.
- Type in the expression representing the required waveform. The
expression sin(2000*pi*t) provided as an example gives a 1000 Hz sine
wave. Further examples showing how to
construct suitable expressions are available.
- Click the Plot signal button to generate the sampled values
of the signal and plot the signal waveform as a function of time. The
plot is automatically scaled to the maximum value.
- Click the Plot spectrumbutton to compute display the
magnitude frequency spectrum of the signal. The plot is scaled to the
largest component of the spectrum. The frequency axis extends from zero
to half the chosen sampling rate (0 - 4000 Hz with the default setting
of 8000 samples/s). Note that you must first generate and plot the
signal by pressing the Plot signal button before the frequency
spectrum can be determined.
FFT Spectrum Analyser applet:
1.02 version |
1.1 version
DSP home page
| Feedback