The waveform is expressed as a function of time t (seconds) and
is constructed using fairly standard notation. The arguments of the
functions sin and cos are in radians; the value of
is
represented by pi. A sine wave of frequency f (Hz), for
example, is expressed as
with an appropriate numerical value substituted for f. Note that multiplication must be indicated explicitly by an asterisk.
The overall amplitude of the waveform function is immaterial since the plot is automatically scaled to accommodate the maximum sampled value; however, the relative amplitudes of different components are significant. This means that the following expressions will yield identical results in terms of the graphical display of the waveform and its spectrum:
In addition to the standard sin and cos functions, the following non-standard functions can also be used in waveform expressions:
The above functions can be added, multiplied etc. to obtain the required waveform, as illustrated by the examples listed below.
| Waveform | Expression |
| 1V, 1000 Hz sine wave with 0·5V DC level | sin(2000*pi*t) + 0.5 |
| 1V, 1000 Hz sine wave with 0·5V random noise | sin(2000*pi*t) + 0.5*noise() |
| Sum of 1V, 1000 Hz sine wave and 2V, 2000 Hz sine wave | sin(2000*pi*t) + 2*sin(4000*pi*t) |
| Product of 1000 Hz and 250 Hz sine waves | sin(2000*pi*t)*sin(500*pi*t) |
| 250 Hz square wave | sqr(500*pi*t) |
| 1500 Hz triangular wave with Hanning window function | tri(3000*pi*t)*hann(t) |
The Hanning window function is widely used to reduce spectral leakage in FFT-based spectrum analysers. To apply this tapered data window, the waveform expression should be multiplied by the hann(t) function.
With a sampling rate of 8000 sample/s and 256 samples selected, generate a 1100 Hz sine wave using the expression
Plot the spectrum and note that there is significant spectral leakage (signal amplitude "leaking" out into adjacent frequency channels, rather than being confined to a single sharp spectral line).
Now modify the waveform expression to read
so that the waveform tapers at either end. Plot the signal and its spectrum and note how the leakage is significantly reduced. The application of a tapered data window prior to the FFT has the side-effect of the broadening of major spectral features, and hence an effective reduction in spectral resolution.
The Java 1.1 spectrum analyser applet offers a selection of tapered data window functions which can be applied to the sampled signal.