**3.1 The Short Time Fourier Transform (STFT)**

The FT is very versatile, but is inadequate when one is interested in the "local" (in time or space) frequency content of the signal. A transform method that can analyze non-stationary signals where the frequency information changes with time is required for this type of analysis.

An obvious method, following on from the FT, is to analyze the time (space) signal over 0-T seconds in a train of shorter intervals such as 0-T/4, T/4-T/2, T/2-3T/4, 3T/4-T, known as windows (Figure 5).

Fig. 5. Short Time Fourier Transform (STFT) with moving non-overlapping rectangular windows.

The individual windows, being only of length T/4 in this case, mean that the lowest frequency fL will be only one-quarter of the full 0-T window value. This method, first described by Gabor (1956), is known as the **Short Time Fourier Transform** (STFT), (see Goswani and Chan (1999) and Qian (2002) for a full discussion). Today, the individual transforms are usually performed using the FFT algorithm where the window shape can be varied; i.e. rectangular, Hanning, cosine taper, etc.

Note in an STFT, as in the FT, the size of the window is fixed but the frequency of the sinusoids that are compared to the signal varies as does the number of oscillations. A small window is unable to detect low frequencies which are too large for the window. If too large a window is used then information about a brief change will be lost. This implies prior knowledge of the signal's characteristics and will become an important criterion for choosing the analysis method. An additional advantage of the non-overlapping STFT is that perfect reconstruction of the original signal g(t) is still possible.

A more recent, but slower, method known as the **adaptive Gabor spectrogram** was developed by Qian and Chen (1994) where the time and frequency resolutions are defined by one parameter. Unlike the classical Gabor expansion, where the time and frequency resolutions are fixed, the time and frequency resolutions of the adaptive Gabor expansion can be adjusted optimally. This method while, it would be acceptable for "off-line" surface measurements was not investigated further in this research because of the slower computational times and the desire to have an efficient method that could be used on-line in a manufacturing environment.

The Use of the Wavelet Transform to Extract

Additional Information on Surface Quality from Optical Profilometers 109

Further examination of figure 8 shows that, unlike the STFT (where the size of the windows are fixed, filled with oscillations of the sine and cosine waves of different frequencies) the reverse is now true in that the number of oscillations is fixed (the mother wavelet shape) but the window width or scale is varied. If the window is stretched, the wavelet frequency is decreased to analyze low frequencies (long times). When the window is compressed, analysis of high frequencies (short times) is possible. Hubbard (1998) called this technique a "mathematical microscope". This initial wavelet shape may be viewed as the **mother wavelet** from which all the other wavelets (in this function class or shape) can be derived. The concept is thus more complicated than the FT in that not only does the multiplying function contain multiple frequencies, but changes its center frequencies as it changes its scale. To overcome the time and resolution uncertainty effect it will be seen that many window (wavelet) widths or resolutions can be written into one algorithm. Although the original idea of the wavelets can be traced back to the **Haar** transform first introduced in 1910 (a German paper published in the Mathematical Annals, Volume 69), wavelets did not become popular until the early 1980's when researchers in geophysics, theoretical physics, and mathematics developed the mathematical foundation (see Qian, 2002). Hubbard (1998) stated that tracing the history of wavelets was almost a job for an archaeologist. Meyer (1989) stated that he had found at least 15 distinct roots of the wavelet theory. Since then considerable work has been conducted by mathematicians and to a lesser degree by engineers. Uses of wavelets were discovered; in particular Mallet (1989) and Meyer (1989) found a close relationship between wavelets and the structure of multi-resolution analysis. Mallat stated that a multi-resolution transform of the signal is equivalent to a set of filters of constant percentage bandwidth in the frequency domain. Work by Mallet and Meyer led to a simple way of calculating the mother wavelet as well as a connection between continuous wavelets and digital filter banks. Following this work, **Daubechies** (1990) further developed a systematic technique of generating finite duration wavelets using sets of discrete difference equations to calculate the wavelet shape. They are designated D4, D20, etc.

Fig. 8. Example of wavelet compression (top) and dilation (bottom)

denoting the number of wavelet describing coefficients, Daubechies (1990).

intense mathematical treatise of wavelets, the reader is referred to Hubbard (1998).

It is not the intent of this chapter to cover the mathematical details of wavelets. The reader can find a comprehensive treatment of wavelet analysis and descriptions in Burrus (1998), Daubechies (1990), Mallat (2009), Newland (1997), and Strang and Nguyen (1996). For a less

An improvement to the STFT time-frequency analysis method is to overlap the windows. Figure 6 demonstrates the sliding window principle.

Fig. 6. Example of Sliding Short Time Fourier Transform

With digitized data, the limit to the time resolution is to move the window one sample at a time to yield up to N windows. There is a clear improvement in time resolution and with present day computer speeds so fast, there is little slowdown in the computation.

#### **3.2 The Wavelet Transform**

The JTFA methods such as the STFT and Wigner-Ville have been criticized for their failure to resolve both time and frequency simultaneously. This led to a search for other functions, besides sine and cosine waves to overcome this problem. These local basis functions, which have been studied in incredible mathematical detail in recent times, are typically used for analyzing non-stationary signals and are known as **wavelets**. Each wavelet is located at a different position along the time (space) axis which decreases to zero on either side of the center position, (see Figure 7) such that the average value (area under the wavelet) is zero. Wavelets are not necessarily of fixed frequency and can be either compressed or dilated in time, which results in a change of scale (see Figure 8). Much like the FT and STFT, multiplication of the signal g(t) by the wavelet shapes as basis functions yields a set of coefficients which describe the correlation between the signal and the wavelet. In particular, depending on the wavelet shape, discontinuities in the signal can be easily detected.

Fig. 7. Morlet mother wavelet function (Hubbard, 1998)

An improvement to the STFT time-frequency analysis method is to overlap the windows.

With digitized data, the limit to the time resolution is to move the window one sample at a time to yield up to N windows. There is a clear improvement in time resolution and with

The JTFA methods such as the STFT and Wigner-Ville have been criticized for their failure to resolve both time and frequency simultaneously. This led to a search for other functions, besides sine and cosine waves to overcome this problem. These local basis functions, which have been studied in incredible mathematical detail in recent times, are typically used for analyzing non-stationary signals and are known as **wavelets**. Each wavelet is located at a different position along the time (space) axis which decreases to zero on either side of the center position, (see Figure 7) such that the average value (area under the wavelet) is zero. Wavelets are not necessarily of fixed frequency and can be either compressed or dilated in time, which results in a change of scale (see Figure 8). Much like the FT and STFT, multiplication of the signal g(t) by the wavelet shapes as basis functions yields a set of coefficients which describe the correlation between the signal and the wavelet. In particular,

present day computer speeds so fast, there is little slowdown in the computation.

depending on the wavelet shape, discontinuities in the signal can be easily detected.

Figure 6 demonstrates the sliding window principle.

Fig. 6. Example of Sliding Short Time Fourier Transform

Fig. 7. Morlet mother wavelet function (Hubbard, 1998)

**3.2 The Wavelet Transform** 

Fig. 8. Example of wavelet compression (top) and dilation (bottom)

Further examination of figure 8 shows that, unlike the STFT (where the size of the windows are fixed, filled with oscillations of the sine and cosine waves of different frequencies) the reverse is now true in that the number of oscillations is fixed (the mother wavelet shape) but the window width or scale is varied. If the window is stretched, the wavelet frequency is decreased to analyze low frequencies (long times). When the window is compressed, analysis of high frequencies (short times) is possible. Hubbard (1998) called this technique a "mathematical microscope". This initial wavelet shape may be viewed as the **mother wavelet** from which all the other wavelets (in this function class or shape) can be derived.

The concept is thus more complicated than the FT in that not only does the multiplying function contain multiple frequencies, but changes its center frequencies as it changes its scale. To overcome the time and resolution uncertainty effect it will be seen that many window (wavelet) widths or resolutions can be written into one algorithm. Although the original idea of the wavelets can be traced back to the **Haar** transform first introduced in 1910 (a German paper published in the Mathematical Annals, Volume 69), wavelets did not become popular until the early 1980's when researchers in geophysics, theoretical physics, and mathematics developed the mathematical foundation (see Qian, 2002). Hubbard (1998) stated that tracing the history of wavelets was almost a job for an archaeologist. Meyer (1989) stated that he had found at least 15 distinct roots of the wavelet theory. Since then considerable work has been conducted by mathematicians and to a lesser degree by engineers. Uses of wavelets were discovered; in particular Mallet (1989) and Meyer (1989) found a close relationship between wavelets and the structure of multi-resolution analysis. Mallat stated that a multi-resolution transform of the signal is equivalent to a set of filters of constant percentage bandwidth in the frequency domain. Work by Mallet and Meyer led to a simple way of calculating the mother wavelet as well as a connection between continuous wavelets and digital filter banks. Following this work, **Daubechies** (1990) further developed a systematic technique of generating finite duration wavelets using sets of discrete difference equations to calculate the wavelet shape. They are designated D4, D20, etc. denoting the number of wavelet describing coefficients, Daubechies (1990).

It is not the intent of this chapter to cover the mathematical details of wavelets. The reader can find a comprehensive treatment of wavelet analysis and descriptions in Burrus (1998), Daubechies (1990), Mallat (2009), Newland (1997), and Strang and Nguyen (1996). For a less intense mathematical treatise of wavelets, the reader is referred to Hubbard (1998).

The Use of the Wavelet Transform to Extract

required) for typical values of n.

Additional Information on Surface Quality from Optical Profilometers 111

Next the wavelet is compressed time-wise into two similar shapes of the same amplitude by a factor of one-half to form level 1, then again by another factor of one-half to form 4 wavelets at level 2, etc. Level -1 is the DC level of the signal. These wavelets are compared to the signal by multiplication generating the coefficients W(s,). Plotting the square of these coefficients yields a 3-dimensional time-scale or time-frequency plot similar to the STFT.

As a reminder, each multiplication of a wavelet with a part of the signal is a correlation or comparison of the signal with the wavelet and is called the wavelet transform coefficient W(s,). Note each wavelet waveform contains the **same** number of oscillations unlike the STFT described earlier. Following Newland (1997), with N samples of the data with N = 2n there will be n+1 levels of wavelet analysis (including the -1 level). There are n sets of wavelet multiplications. If N = 128 = 27 there will be 1, 2, 4, 8, 16, 32, and 64 wavelet compressions describing the shifts from level 0 through level 7. Note that the total number of multiplications is 127 which is of order (N). Following Hubbard (1998), if each wavelet is described or supported by c samples, the number of multiplications is cN. Thus the DWT is of the same order of computational efficiency as the FFT (where Nlog2N multiplications are

The alternative filter bank approach (Strang and Nguyen, 1996) looks at data signals conceptually in the frequency domain. Approaching the method via the DWT, each wavelet

**Bandwidth of STFT window** 

**Bandwidth of CWT window** 

behaves as a band-pass filter in the frequency domain (see Figure 10).

Fig. 10. Bandwidth of data windows for STFT (top) and DWT (bottom)

functional form, **harmonic wavelets** have the simple structure:

A third technique proposed by Newland (1993) is based on the fast Fourier transform (FFT) using an **exact** octave-band filter shape defined in the frequency domain (e.g. from frequency 1 to 2). Fourier coefficients are processed in octave-bands to generate wavelet coefficients by an orthogonal transformation which is implemented by the FFT. Unlike wavelets generated by discrete dilation equations whose shapes cannot be expressed in
