**3.2.1 Description of wavelets**

While both STFT (and other JTFA techniques) and wavelets can be used for time-frequency analysis, they each have a distinct set of advantages and disadvantages. The STFT is suited for narrow instantaneous frequency bandwidths (such as chirps), while the wavelet (timescale) transforms are best suited for signals that have instantaneous peaks or discontinuities (image description, sound generated by engine knocks, etc.) (Qian, 2002).

There are two major categories of wavelet transforms; continuous and discrete (Gaberson, 2002). According to Gaberson, the continuous wavelet transform (CWT) is easier to describe. The CWT is a "short wavy" function that is stretched or compressed and placed at many positions along the signal to be analyzed. The wavelet is then term-by-term multiplied with the signal, each product yielding a wavelet coefficient value. Just as the STFT with its non-overlapping time windows historically came before the (continuous) sliding STFT so have applications of the discrete wavelet transform (DWT) historically come before the CWT. In the DWT there will be a finite number of wavelet comparisons whereas in the CWT there could be an infinite number. Since this chapter is part of a book on applications of wavelets and is companioned with a book on the theory of wavelets the background of wavelets will not be discussed in detail here.

As mentioned above, the original goal of this research was to develop a fast online surface quality technique. While both CWT and DWT were originally investigated only the DWT was considered for much of the research due to the computational speeds of the two types. For an online surface quality evaluation system it was convenient to look at the case of the discrete wavelet transform (DWT), where the number of wavelets is not only finite but also lead to a particularly efficient algorithm. With N samples of the data record taken, the wavelet (t) occupying the time interval 0-T, designated level 0 (see Newland, 1997), is shown in Figure 9.

Fig. 9. The scaling and shifting process of the DWT

While both STFT (and other JTFA techniques) and wavelets can be used for time-frequency analysis, they each have a distinct set of advantages and disadvantages. The STFT is suited for narrow instantaneous frequency bandwidths (such as chirps), while the wavelet (timescale) transforms are best suited for signals that have instantaneous peaks or discontinuities

There are two major categories of wavelet transforms; continuous and discrete (Gaberson, 2002). According to Gaberson, the continuous wavelet transform (CWT) is easier to describe. The CWT is a "short wavy" function that is stretched or compressed and placed at many positions along the signal to be analyzed. The wavelet is then term-by-term multiplied with the signal, each product yielding a wavelet coefficient value. Just as the STFT with its non-overlapping time windows historically came before the (continuous) sliding STFT so have applications of the discrete wavelet transform (DWT) historically come before the CWT. In the DWT there will be a finite number of wavelet comparisons whereas in the CWT there could be an infinite number. Since this chapter is part of a book on applications of wavelets and is companioned with a book

on the theory of wavelets the background of wavelets will not be discussed in detail here.

As mentioned above, the original goal of this research was to develop a fast online surface quality technique. While both CWT and DWT were originally investigated only the DWT was considered for much of the research due to the computational speeds of the two types. For an online surface quality evaluation system it was convenient to look at the case of the discrete wavelet transform (DWT), where the number of wavelets is not only finite but also lead to a particularly efficient algorithm. With N samples of the data record taken, the wavelet (t) occupying the time interval 0-T, designated level 0 (see Newland, 1997), is shown in Figure 9.

(image description, sound generated by engine knocks, etc.) (Qian, 2002).

Fig. 9. The scaling and shifting process of the DWT

**3.2.1 Description of wavelets** 

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 required) for typical values of n.

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 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)

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 functional form, **harmonic wavelets** have the simple structure:

$$
\psi'(t) = \left(e^{\left(j\left4\pi t\right)} - e^{j2\pi t}\right) / \ j \mathbf{2}\,\pi t\tag{1}
$$

The Use of the Wavelet Transform to Extract

principle.

of 5 marks per inch.

**3.2.3 Comparison of STFT and harmonic wavelet** 

slippage of the feed system (Figure 12).

Time Fourier Transform (STFT) and the Newland Harmonic DWT.

Additional Information on Surface Quality from Optical Profilometers 113

8192 samples per inch). Obtaining this level of sampling, on-line and in real-time makes the speed of the analysis process critical. As mentioned before, the literature is full of different wavelet functions but very little advice is presented in the literature on choosing the best wavelet for the task. The advice normally is to choose a wavelet that is "similarly" shaped to the signal to be analyzed and then to try several wavelets. Hubbard (1998) devotes an entire chapter to discussing which wavelet should be used. There are definite differences of opinions on the procedure to follow. One is to use the commonly used wavelets such as the Mexican Hat and Morlet. The other extreme is to develop a new wavelet for a particular purpose. The question, as discussed in Hubbard, then arises as to what are the properties that are desired for the new wavelet. While the desire may be in trying to get fine resolution for **both** time and frequency domain, this is impossible and violates the uncertainty

As mentioned in a previous section, periodic knife marks on a surface are a primary surface defect of interest in wood machining. Usually the higher the frequency of the knife marks, the lower the amplitude and the less objectionable the marks. From a series of field tests conducted as part of this research it was found that objectionable knife marks on moulder and planers as well as sanding "chatter" marks on wide belt sanders often occur in the range

In the research presented by Lemaster (2004) the various DWT and CWT were compared to the STFT. In addition, direct comparisons between the Harmonic and Daubachies D20 DWT techniques were also conducted. As mentioned previously, the CWT techniques did not provide enough increase in resolution to justify the added computational intensity. Also, a benefit of the Harmonic DWT was that it provided direct frequency information instead of scaling information which is only indirectly proportional to the frequency. So for the remainder of this discussion, a comparison was done between the more established Short

A series of simulated signals (waves) were generated to compare the ability of the two techniques to detect simulated surface defects including changing frequency and a localized defect (scratch or gouge on wood). The resulting plots were shown in units of length of scan and spatial frequency (marks per inch) to illustrate the plots in terms of spatial frequency for the actual surface scans. The plots consisted of 8192 data points over a 1 inch length of simulated scan. The STFT and DWT plots that were conducted on a reduced data set (every 16th data point for faster calculation speed) missed small defects such as the scratch. As discussed above, for larger defects such as the presence of a periodic component, the reduced data set still yielded a sufficient sampling frequency for the frequency and joint time/frequency analysis while maintaining the high sampling density required for time domain analysis. The first series of comparison was between two sine waves (5 Hz and 20 Hz). These frequencies were chosen because they approximate a single knife and a four knife finish on a typical moulder or planer operation. Two versions of the sine waves can exist, the first is when the two frequencies are superimposed on each other as when there are two sources of machine vibration and the second condition is when the two frequencies are appended to each other as when the feed rate has changed due to an alteration or

This function is concentrated locally around t = 0, and is orthogonal to its own unit translations and octave dilations. Its frequency spectrum is confined exactly to an octaveband so that it is compact in the frequency domain instead of the time domain, see Figure 11, which shows a comparison of the Newland harmonic wavelet with the Daubechies D20 wavelet in the frequency domain (Newland, 1993). The Newland harmonic wavelet, being complex, can incorporate phase like some other wavelets but its amplitude decreases to zero at a slower rate of 1/t than some other wavelets. The Newland harmonic wavelet has been found to be particularly suitable for vibration and acoustic analysis because its harmonic structure is similar to naturally occurring signal structures and, therefore, they correlate well with experimental signals.

Fig. 11. Comparison of the Daubechies - D20 (a) and Newland harmonic wavelets (b) in the time domain as well as the frequency domain (c)

Generally there is no exact simple relationship between the scale (s) and frequency (f), except to say that scale is approximately inversely proportional to the frequency so that high frequencies refer to low scales and vice versa. An advantage of the Newland harmonic wavelet is that he is able to use an **accurate frequency axis** in place of scale and the scale axis may be exactly written as the inverse frequency.

#### **3.2.2 Wavelet selection**

A challenge exists in choosing a wavelet best suited for analyzing wood surfaces. Due to the desire to detect small localized defects, a high sample density is needed (i.e. in the range of

 (4 ) 2 ) ( ) / 2 *jt jt te e j t* 

This function is concentrated locally around t = 0, and is orthogonal to its own unit translations and octave dilations. Its frequency spectrum is confined exactly to an octaveband so that it is compact in the frequency domain instead of the time domain, see Figure 11, which shows a comparison of the Newland harmonic wavelet with the Daubechies D20 wavelet in the frequency domain (Newland, 1993). The Newland harmonic wavelet, being complex, can incorporate phase like some other wavelets but its amplitude decreases to zero at a slower rate of 1/t than some other wavelets. The Newland harmonic wavelet has been found to be particularly suitable for vibration and acoustic analysis because its harmonic structure is similar to naturally occurring signal structures and, therefore, they correlate well

 **D20 Harmonic**  Fig. 11. Comparison of the Daubechies - D20 (a) and Newland harmonic wavelets (b) in the

Generally there is no exact simple relationship between the scale (s) and frequency (f), except to say that scale is approximately inversely proportional to the frequency so that high frequencies refer to low scales and vice versa. An advantage of the Newland harmonic wavelet is that he is able to use an **accurate frequency axis** in place of scale and the scale

A challenge exists in choosing a wavelet best suited for analyzing wood surfaces. Due to the desire to detect small localized defects, a high sample density is needed (i.e. in the range of

time domain as well as the frequency domain (c)

axis may be exactly written as the inverse frequency.

**3.2.2 Wavelet selection** 

with experimental signals.

 

(1)

8192 samples per inch). Obtaining this level of sampling, on-line and in real-time makes the speed of the analysis process critical. As mentioned before, the literature is full of different wavelet functions but very little advice is presented in the literature on choosing the best wavelet for the task. The advice normally is to choose a wavelet that is "similarly" shaped to the signal to be analyzed and then to try several wavelets. Hubbard (1998) devotes an entire chapter to discussing which wavelet should be used. There are definite differences of opinions on the procedure to follow. One is to use the commonly used wavelets such as the Mexican Hat and Morlet. The other extreme is to develop a new wavelet for a particular purpose. The question, as discussed in Hubbard, then arises as to what are the properties that are desired for the new wavelet. While the desire may be in trying to get fine resolution for **both** time and frequency domain, this is impossible and violates the uncertainty principle.

As mentioned in a previous section, periodic knife marks on a surface are a primary surface defect of interest in wood machining. Usually the higher the frequency of the knife marks, the lower the amplitude and the less objectionable the marks. From a series of field tests conducted as part of this research it was found that objectionable knife marks on moulder and planers as well as sanding "chatter" marks on wide belt sanders often occur in the range of 5 marks per inch.
