You are on page 1of 9

Chemometrics and Intelligent Laboratory Systems 69 (2003) 157 165 www.elsevier.

com/locate/chemolab

A general approach to derivative calculation using wavelet transform


Xueguang Shao *, Chaoxiong Ma
Department of Chemistry, University of Science and Technology of China, Hefei, Anhui 230026, PR China Received 20 January 2003; received in revised form 31 July 2003; accepted 7 August 2003

Abstract Application of wavelet transform (WT) for derivative calculation has been reported based on the property of specific wavelet function: Haar, Daubechies and Gaussian wavelets. In this work, the underlying principle of the wavelet transform for derivative calculation is investigated, and a general approach is proposed. By theoretical analysis, it can be found that wavelet transform with commonly used wavelet functions can be regarded as a smoothing and a differentiation process, and the order of differentiation is determined by the property of the wavelet function. Derivatives of different simulated signals by using all the commonly used wavelet functions are investigated and compared with the conventional numerical differentiation method. It is shown that differentiation is a common property of all these wavelet functions, and nth-order derivative can be simply obtained through just one transform procedure, instead of repeated transform, by using an appropriate wavelet function. Furthermore, both discrete wavelet transform and continuous wavelet transform show similar characteristic with a given wavelet function. D 2003 Elsevier B.V. All rights reserved.
Keywords: Wavelet transform; Derivative calculation; Differentiation

1. Introduction Derivative calculation is a useful technique widely used in analytical chemistry. It has been employed for reducing background effect and enhancing resolution in spectroscopy [1 4], baseline correction, resolving overlapping peaks and quantitative determination in chromatography [5 7] and also determining the endpoint of potentiometric titration in electrochemis-

* Corresponding author. Tel.: +86-551-3606160; fax: +86-5513601592. E-mail address: xshao@ustc.edu.cn (X. Shao). 0169-7439/$ - see front matter D 2003 Elsevier B.V. All rights reserved. doi:10.1016/j.chemolab.2003.08.001

try [8,9]. The simplest method for derivative calculation is numerical differentiation [10], but it is not very useful for real signal because of the rapid degradation of signal-to-noise ratio (SNR). Two more commonly used methods are polynomial method of Savitzky Golay [11 13] and Fourier transform [14,15]. The problems encountered in using these two methods include the difficulties in choosing the proper parameters, complex calculations involved and limits in application to the experimental signal with low SNR. Besides these conventional methods, wavelet transforms (WT), a technique that popularly used in processing of analytical signals recently [16 18], was also proposed for derivative calculation [19

158

X. Shao, C. Ma / Chemometrics and Intelligent Laboratory Systems 69 (2003) 157165

21]. The first method was introduced by Leung et al. [19]. Derivatives can be calculated based on the difference of the coefficients generated from two Daubechies wavelet functions. In our previous study [20], continuous wavelet transform (CWT) through Haar wavelet, a ladder-shaped function, is adopted for derivative calculation. As the derivative of Gaussian function, Gaussian wavelet was also found to be applicable for derivative calculation [21]. It was shown that compared with the conventional methods, there are some advantages in using WT for derivative calculation, e.g., simplicity in algorithm and improvement in SNR [19 21]. However, in these studies, only the specific wavelet functions (Daubechies, Haar and Gaussian) were investigated; they did not give us a general rule for using the method. In addition, highorder derivative must be calculated by repeated transforms from its previous order derivative, and the

distortion in the line shape of the calculated result is unavoidable when using large-scale parameter for signals with low SNR [21]. In this work, the underlying principle of WT for derivative calculation is studied. It is found that wavelet transforms with commonly used wavelet functions can be regarded as a smoothing and a differentiation process, and the order of differentiation is determined by the property of the wavelet function. All the commonly used wavelet functions can be used for derivative calculation through continuous wavelet transform (CWT) or discrete wavelet transform (DWT). The calculation of nth-order derivative can be achieved by only one transform procedure, instead of repeated transforms. By the application to the experimental signals, it is proved that the proposed method is very efficient in derivative calculation.

Fig. 1. The operation of polynomial suppression with wavelets. Solid curves in (a) (d) are f (t) = kt, f (t) = kt2, f (t) = kt3 and f (t) = kt4, respectively. Straight dot lines in (a) (d) are the suppressed results with Gaussian wavelet function of gaus2, gaus3, gaus4 and gaus5, which has two, three, four and five vanishing moments, respectively.

X. Shao, C. Ma / Chemometrics and Intelligent Laboratory Systems 69 (2003) 157165

159

2. Theory Wavelet is defined as a series of functions wa,b(t) derived from a function w(t) by dilation and translation [22]   1 tb wa;b t p w ; a p 0; a; baR 1 a AaA where a is the scale parameter that controls the dilation, b is the shift parameter that controls the translation and w(t) is the basis function of a wavelet. One of the most important properties of the wavelet is the vanishing moment. w(t) is said to have n vanishing moments when it satisfies that [23] Z l t k wtdt 0 for 0 V k < n 2
l

and f (t) = kt4, respectively, which are suppressed to f (t) = 0 (dot line) through the convolution with the wavelet that has two, three, four and five vanishing moments, respectively. The operation can be viewed as the differentiation of f (t), in which wavelets act as the differential operators. This means that a wavelet function with n vanishing moments can be written as the nth-order differentiation of a function h(t) [24] wt 1n dn ht dt n 3

A wavelet with n vanishing moments is orthogonal to polynomial of degree n 1, i.e., it can be used to suppress polynomial of degree n 1 through convolution. Fig. 1 shows the working process. The solid line in curves (a) (d) are f (t) = kt, f (t) = kt2, f (t) = kt3

where h(t) is a function with fast decay and whose integral is a nonzero constant, i.e., h(t) satisfies the condition of a smoothing function [25]. Hence, a wavelet function w(t) can be denoted as the nth-order derivative of a smooth function h(t). A typical example is the Gaussian wavelet families. As it is shown in Fig. 2, curve (a) is the Gaussian function, and curves (b) (f) are the Gaussian wavelets of gaus1 gaus5, which correspond to the first- to fifth-order derivatives of the Gaussian function, respectively. The wavelet transform is defined as the projection of a function or a signal onto the wavelet. With a

Fig. 2. The Gaussian wavelet families. Curve (a) is a Gaussian function. Curves (b) (f) are Gaussian wavelet functions gaus1 gaus5, which correspond to the first to fifth derivatives of Gaussian functions, respectively.

160

X. Shao, C. Ma / Chemometrics and Intelligent Laboratory Systems 69 (2003) 157165

wavelet function that has n vanishing moments, the transform can be given by [24]  n  n d ha Wf a; b f *wa b f * a b dt n an dn f *ha b dt n 4

where * denotes the operator of convolution, and 1 t wa t w a a ha t 1 t h a a 5

From Eq. (4), it can be seen that the essence of the wavelet transform through a wavelet function with n vanishing moments is equal to calculation of the nthorder derivative of the signal f (t) smoothed by ha(t). This operation can be illustrated in Fig. 3. Curve (a) is

a Sigmoid signal, f (t), with 5.0% noise level. Curve (b) is the signal smoothed by Gaussian function, f *ha(b), while curve (c) is the result of wavelet transform, Wf (a,b), which is equivalent to the derivative of the smoothed signal f *ha(t). Therefore, the nth-order derivative calculation of an analytical signal can be obtained through one wavelet transform by using a wavelet function with n vanishing moments. For example, the first and second derivatives can be calculated with Daubechies wavelets db1 and db2, which has one and two vanishing moments, respectively. In practice, both CWT and DWT can be used for derivative calculation. Multiresolution signal decomposition (MRSD) algorithm [26] is often used for DWT. The essence of MRSD is to project a signal into two orthogonal subspaces, and the projection can further proceed into finer subspaces recursively. Therefore, MRSD can be conveniently used to decompose the signal into components with different frequency. The MRSD, however, demands the data points to be exactly 2n (n is an integer), and data points will be reduced by half in each decomposition. To overcome this problem, the improved MRSD was adopted for DWT calculation [16]. However, it should be noted that this algorithm is not applicable to the wavelets without orthogonality, e.g., Gaussian and Mexican hat wavelet because their scale functions are not available. Another problem that encountered in the WT calculation in this paper is the boundary effects, which was coped with the method of symmetric extension [27].

3. Experimental 3.1. Simulated signals The Gaussian, Lorentzian and Sigmoid functions are used to simulate the curves of chromatogram, spectrum and titration in analytical chemistry studies, which are calculated with Eqs. (6) (8), respectively.
Fig. 3. The essence of wavelet transform. Curve (a) is a Sigmoid signal with 5.0% noise, f (t). Curve (b) is the smoothed f (t) with Gaussian function, f *ha(t). Curve (c) is the wavelet transform of f (t), Wf (a,b), obtained by CWT with Gaussian wavelet gaus1. It is equivalent to the first-order derivative of f *ha(t).

t t0 f t hexp 4ln2 W1=2

"

2 # 6

X. Shao, C. Ma / Chemometrics and Intelligent Laboratory Systems 69 (2003) 157165

161

t t0 f t h 1 4 W1=2

"

2 #1 7 8

f t h1 exprt t0 1

The parameters h, t0 and W1/2 are the intensity, center position and width at half-height of the simulated signals, respectively, and r is the slope parameter of the titration curve. Parameter t is sampled discretely by t = n*D, with D as the sampling interval, and n = 1. . .N as the index of the data point. N = 800, D = 0.01, h = 1.0 and t0 = 4 are used for all three signals, W1/2 = 120 is used for Gaussian and Lorentzian signals and r = 5 is used for Sigmoid signal. 3.2. Experimental signals A photoacoustic spectrum of compound Pr(Gly)3 Cl33H2O and a chromatogram of three-component mixed rare-earth solution of Yb, Tm and Tb are used in this study. Detailed description of the sample preparation and experimental condition can be found in our previous works [20,28].
Fig. 4. Simulated signal and its derivatives obtained by the WT method. Curve (a) is the simulated signal. Curves (b) and (d) are the first and second derivatives obtained by CWT with wavelet functions bior1.5 and bior2.8, respectively. Curves (c) and (e) are the first and second derivatives obtained by numerical differentiation for comparison.

4. Result and discussion 4.1. General property of wavelet transform in derivative calculation In order to investigate the property of WT with different wavelet function in derivative calculation, a curve with the combination of the simulated Gaussian, Lorentzian and Sigmoid signals, as shown in Fig. 4a, is used. In Fig. 4, (b) and (d) are examples of the first- and second-order derivatives obtained through CWT with Biorthogonal spline wavelet, while (c) and (e) are those obtained by numerical differentiation, respectively. It is clear that no significant difference between the line shapes obtained by the two methods. In order to compare the similarity of the results by WT and numerical differentiation, the correlation coefficient r is used as criterion. Table 1 summarizes the wavelet functions that can be used for calculation of different order derivative, and their corresponding r obtained with DWT and

CWT, respectively. The decomposition scale 1 is used for DWT, and scale parameter 2 is used for all wavelet functions in CWT except that 10 is used for Gaussian wavelet because the line shapes of the derivative cannot be fully exhibited at very smallscale parameter [21]. From Table 1, it can be seen that many wavelet functions are available for the calculation of different order derivatives. All the commonly used wavelet functions can be used for derivative calculation besides Haar, Daubechies or Gaussian. In addition, the derivative order that a wavelet function can be used for is very easy to be determined because the vanishing moment of a wavelet function is corresponding to its order. The vanishing moment of most wavelet functions is the same as its order, except Coiflets wavelet families, whose vanishing moment is double as its order. Consequently, the nth derivative of an analytical signal can be easily obtained through wavelet transform by choosing a corresponding wavelet function. The correlation efficient r is a measure of the similarity between the line shapes of the derivative

162

X. Shao, C. Ma / Chemometrics and Intelligent Laboratory Systems 69 (2003) 157165

Table 1 Property of wavelet functions in derivative calculation Wavelet function Correlation coefficient DWT First derivative Daubechies 1 bior1.1a bior1.3 bior1.5 Gaussian 1 Second derivative Daubechies 2 Symlets 2 Coiflets 1 bior2.2 bior2.4 bior2.6 bior2.8 Gaussian 2 Mexican hat Third derivative Daubechies 3 Symlets 3 bior3.1 bior3.3 bior3.5 bior3.7 bior3.9 Gaussian 3 Fourth derivative Daubechies 4 Symlets 4 Coiflets 2 bior4.4 Gaussian 4 Fifth derivative Daubechies 5 Symlets 5 Gaussian 5 Sixth derivative Symlets 6 Coiflets 3 bior6.8 Gaussian 6
a b

CWT 1.000 1.000 1.000 1.000 1.000

1.000 1.000 1.000 1.000


b

1.000 1.000 1.000 1.000 1.000 1.000 1.000


b b

0.998 0.998 0.999 1.000 1.000 1.000 1.000 0.999 0.999

obtained by numerical differentiation and WT method. From the results in Table 1, it can be seen that all values of r are very close to 1.0, which means that the results obtained by WT are very close to those obtained by numerical differentiation. At the same time, it can be deduced that results obtained by CWT and DWT are also very close. It can be also seen that the correlation coefficient deteriorates as the order of derivative increases, which is mainly due to different effect of the smoothing on the derivative of different order. Although the same scale parameter was used in each order of derivative calculation, derivative of higher order is more sensitive to smoothing because of its sharper peaks. 4.2. The effect of the scale parameter on the resolution of the calculated derivatives One of the most important applications of derivative calculation is resolution enhancement, which can be evaluated by the width at half-height (W1/2) of a signal. Generally, the higher the derivative order, the smaller the W1/2, thus, the sharper the peak will be. However, the efficiency of resolution improvement by WT may not be the same as numerical differentiation since a smoothing procedure is included as mentioned above. The smoothing in WT is controlled by the scale parameter, which can be viewed as the size of the smoothing window. Therefore, the effect of scale parameter on the W1/2 is investigated. A simulated Gaussian signal is used and the results with wavelet functions of Daubechies 2 (db2), Coiflets 1 (coif1), Biorthogonal spline 2.8 (bior2.8) and Gaussian 2 (gaus2) are compared. Instead of using W1/2 directly, relative deviation (R) of W1/2 obtained by the proposed method (W1/2,WT) from that obtained by numerical differentiation (W1/2,ND) is adopted and calculated by W1=2;WT W1=2;ND 100% W1=2;ND

1.000 1.000 0.999 0.999 0.999 0.999 0.999


b

0.993 0.993 0.999 0.999 0.999 0.999 0.999 0.995

1.000 0.997 1.000 0.999


b

0.985 0.996 0.995 0.998 0.992

0.999 0.996
b

0.970 0.994 0.984

0.991 1.000 0.995


b

0.986 0.986 0.992 0.981

Biorthogonal spline wavelet. The results are not available because the adopted DWT algorithm is not applicable for Gaussian and Mexican hat wavelets.

Fig. 5 shows the variation of R of the second-order derivative with the scale parameter. It can be seen that the general tendency of the four curves is in a similar way that the W1/2 grows up with the scale parameter. However, the slopes of the growth for different wavelet function are quite different. It is notable that W1/2 of the

X. Shao, C. Ma / Chemometrics and Intelligent Laboratory Systems 69 (2003) 157165

163

two signals is larger than that for Gaussian signal. However, when the scale parameter is smaller than 60, the relative deviation of all signals is less than 10.0%. Within certain scale parameter, the efficiency of resolution enhancement by WT differentiation can be retained. 4.3. Efficiency of WT method in SNR improvement The principal problem encountered in derivative calculation with conventional methods is the degradation of SNR, especially when the noise level is high in original signal. A smoothing process either simultaneously or separately must be adopted for overcoming the problem. However, smoothing always causes a loss of the efficiency in resolution enhancement. Generally, the performance of an algorithm can be evaluated by how well it can suppress the noise without worsening the resolution. In order to investigate the performance of the WT method in SNR improvement, the ratio between the SNR of the calculated derivative (SNRD) and the original signal (SNR0) is used as a criterion. Fig. 7 shows the variation of SNRD/SNR0 with noise level contained in the original signal. In the calculation, Gaussian signal and the wavelet functions bior2.8 and gaus2 are adopted. Scale parameters 120 and 33 are, respectively, used for bior2.8 and gaus2 to ensure that the relative deviation of W1/2 is less than 10.0%.

Fig. 5. The effect of scale parameter on the resolution improvement of bior2.8 (a), coif1 (b), db2 (c) and gaus2 (d) wavelet functions.

derivative obtained by gaus2 increases rapidly with scale parameter. In contrast, the variation of that obtained by bior2.8 is relative small, no obvious change can be seen in its W1/2 even when the scale parameter is up to 100. This property of Biorthogonal spline wavelet makes it very efficient in the application to real signals, especially those with very low SNR. Fig. 6 shows a comparison of the relative deviation R for Gaussian, Lorentzian and Sigmoid signal. bior2.8 is used in the calculation. From the figure, similar tendency as Gaussian signal can be found with the Lorentzian and Sigmoid signal, but the variation for the

Fig. 6. The effect of scale parameter on the results for Gaussian (a), Sigmoid (b) and Lorentzian (c) signals.

Fig. 7. The effect of noise on the SNR improvement of gaus2 (a) and bior2.8 (b) wavelet functions.

164

X. Shao, C. Ma / Chemometrics and Intelligent Laboratory Systems 69 (2003) 157165

It can be seen from Fig. 7 that within the noise levels 1.0% 30%, both SNRD/SNR0 are larger than 1.0, which means that the SNR of the signal is even better than that of the original signal. The SNR improvement obtained with gaus2 is about 2.5, and changes very little even when the noise level is up to 30%. As for the result with bior2.8, although the SNR improvement drops rapidly as the noise level increases, a very high SNR improvement efficiency with SNRD/SNR0 z 4.0 can be retained in all noise levels. Fig. 8 shows an example of both resolution and SNR improvement by the proposed method. Curve (a) is a simulated signals with SNR = 20, and curve (b) is the second-order derivative obtained by CWT with bior2.8. It can be found that a very smooth derivative with little distortion is obtained. For signals with such a low SNR, it is impossible to obtain a reasonable derivative using the numerical differentiation method. 4.4. Application to experimental signals In order to test the performance of the proposed method in derivative calculation of experimental signals, curve (a) in Fig. 9 shows the photoacoustic spectrum of Pr(Gly)3Cl33H2O. It can be seen that the spectrum is covered with high-level noise, and several

Fig. 9. The photoacoustic spectrum (a) and its second-order derivative obtained by CWT with bior2.8 (b) and Haar (c) wavelet functions, respectively.

peaks are overlapping within the range of 400 500 nm. Consequently, the peaks in the spectrum are very difficult to be discriminated. Curve (b) shows the second derivative of the spectrum obtained by the proposed method with bior2.8 wavelet function and scale parameter as 120. It is obvious that the resolution is greatly enhanced without degrading the SNR. Thus, the peak value is very easy to be determined from the resolved spectrum. The peak positions obtained from the derivative are 451.3, 476.0, 490.1 and 593.6 nm, respectively, which are in accordance with the

Fig. 8. The simulated signal with SNR = 20 (a) and its second derivative obtained by CWT with wavelet function bior2.8 (b).

Fig. 10. The chromatogram (a) and its second derivative obtained by CWT with wavelet function bior2.8 (b).

X. Shao, C. Ma / Chemometrics and Intelligent Laboratory Systems 69 (2003) 157165

165

corresponding energy transition band of the compound [20]. Curve (c) is the second derivative obtained by Haar wavelet, which is cited from our previous work [20] for comparison. Although the line shapes are not much different, curve (b) is smoother and its peaks are also sharper than those in curve (c). The W1/2 of the fourth peaks in curves (b) and (c) are 74 and 82, respectively. This comparison further demonstrates the superiority of Biorthogonal spine wavelet in derivative calculation. Curve (a) in Fig. 10 shows the chromatogram of a three-component mixed rare earth solution. With such a high noise level, overlapping peaks and drifting baseline, the chromatogram can not be used for quantitative determination without pretreatment. Curve (b) shows the second derivative of the chromatogram obtained by the proposed method with bior2.8. It is apparent that the noise is suppressed, drifting baseline is corrected and overlapping peaks are resolved as well. Consequently, the peak areas are very easy to be determined. In addition, derivative is a linear operation, which makes it a possible tool for the resolution and quantitative analysis of the overlapping chromatograms [5,6].

Acknowledgements This study is supported by the Teaching and Research Award Program for Outstanding Young Teachers (TRAPOYT) in higher education institutions of the Ministry of Education (MOE), PR China. References
[1] J.A. Howell, L.G. Hargis, Anal. Chem. 66 (1994) 445R 461R. [2] W. Windig, Chemom. Intell. Lab. Syst. 23 (1994) 71 86. [3] S.S. Kharintsev, D.I. Kamalova, M.K. Salakhov, Appl. Spectrosc. 54 (2000) 721 730. [4] A. OGrady, A.C. Dennis, D. Denvir, J.J. McGarvey, S.E.J. Bell, Anal. Chem. 73 (2001) 2058 2065. [5] D.Y. Youn, S.J. Yun, K.H. Jung, J. Chromatogr., A 591 (1992) 19 29. [6] S.H. Liu, X.A. Tian, X.G. Chen, Z.D. Hu, J. Chromatogr., A 928 (2001) 109 115. [7] R. Danielsson, D. Bylund, K.E. Markides, Anal. Chim. Acta 454 (2002) 167 184. [8] S.A. Kholeif, Anal. Sci. 17 (2001) 715 720. [9] M.M. Rigobello, J.C. Masini, Anal. Chim. Acta 448 (2001) 239 250. [10] T.C. OHaver, T. Begley, Anal. Chem. 53 (1981) 1876 1878. [11] A. Savitzky, M.J.E. Golay, Anal. Chem. 36 (1964) 1627 1638. [12] P.A. Gorry, Anal. Chem. 62 (1990) 570 573. [13] P. Barak, Anal. Chem. 67 (1995). [14] J.K. Kauppinen, D.J. Moffatt, H.H. Mantsch, D.G. Cameron, Anal. Chem. 53 (1981) 1454 1457. [15] D.G. Cameron, D.J. Moffatt, Appl. Spectrosc. 41 (1987) 539 544. [16] X.G. Shao, W.S. Cai, Rev. Anal. Chem. XVII (1998) 235 285. [17] A.K.M. Leung, F.T. Chau, J.B. Gao, Chemom. Intell. Lab. Syst. 43 (1998) 165 184. [18] B. Walczak, D.L. Massart, TRAC, Trends Anal. Chem. 16 (1997) 451 463. [19] A.K.M. Leung, F.T. Chau, J.B. Gao, Anal. Chem. 70 (1998) 5222 5229. [20] X.G. Shao, C.Y. Pang, Q.D. Su, Fresenius J. Anal. Chem. 367 (2000) 525 529. [21] L. Nie, S.G. Wu, X.Q. Lin, L.Z. Zheng, L. Rui, J. Chem. Inf. Comput. Sci. 42 (2002) 274 283. [22] A. Grossmann, J. Morlet, SIAM J. Math. Anal. 15 (1984) 723 736. [23] S. Mallat, W.L. Hwang, IEEE Trans. Inf. Theory 38 (1992) 617 643. [24] S.G. Mallat, A Wavelet Tour of Signal Processing, Academic Press, New York, NY, 1998, p. 166. [25] S. Mallat, S. Zhong, IEEE Trans. Pattern Anal. 14 (1992) 710 732. [26] S.G. Mallat, IEEE Trans. Pattern Anal. Mach. Intell. 11 (1989) 674 693. [27] U. Depczynski, K. Jetter, K. Molt, A. Niemoller, Chemom. Intell. Lab. Syst. 49 (1999) 151 161. [28] X.G. Shao, L. Sun, Anal. Lett. 34 (2001) 267 280.

5. Conclusion The underlying principle and general property of wavelet transform in derivative calculation are investigated with both simulated and experimental signals. It is demonstrated that wavelet transform is a combined operation of smoothing and differentiation. All commonly used wavelets can be used for derivative calculation through either CWT or DWT. In addition, the nth-order derivative of a signal can be obtained through one transform with a wavelet function that has n vanishing moments. Furthermore, by using an appropriate scale parameter, both resolution and SNR of the signal can be improved through differentiation with the proposed method. The comparison of different wavelet functions in derivative calculation shows that Biorthogonal spine wavelet is superior to those proposed previously, such as Daubechies, Haar and the Gaussian wavelet. With the property of SNR improvement without losing the efficient in resolution enhancement, the proposed method is preferable to the convention methods, especially for the signal with low SNR.

You might also like