## 2 The Coarse-to-Fine Free-Form Surface Machining Error Decomposition and Compensation Process
### Principle of Machining Error Decomposition from Coarse to Fine
#### 2.3.2 Principle of the EMD Algorithm
The wavelet basis function selected in this paper is the Daubechies wavelet, abbreviated as db \(N\), where \(N\) is the order of the wavelet, which is commonly used to decompose and reconstruct signals with good results. In general, the wavelet thresholding decomposition process can be divided into three steps: wavelet decomposition, thresholding quantization of the high-frequency coefficients of wavelet decomposition and wavelet reconstruction [28]. The commonly used thresholding quantization rules are generally divided into hard and soft thresholding, and the hard thresholding function tends to cause oscillations in the reconstructed signal. Therefore, in this paper, a soft thresholding function is used, which can be expressed by  
\[\sigma_{\lambda}^{\mathrm{S}}=\left\{ \begin{array}{cc}[\mathrm{sgn}(\omega) ](|\omega|-\lambda)&,|\omega|\geq\lambda\\ 0&,|\omega|<\lambda\end{array} \right. \tag{17}\]  
where \(\omega\) is the wavelet coefficient, and \(\lambda\) is the thresholding value. The determination of the thresholding \(\lambda\) is an important step in the decomposition of processing errors by the wavelet thresholding method which has a great influence on the decomposition effect. When the thresholding is too small, the decomposition may be incomplete, and interference information may remain; when the thresholding is too large, useful information may be lost. Currently, fixed thresholding, which is based on the Gaussian noise model and derived from the decision theory of independent normal variables, is widely used [29]. This paper chooses to use a fixed thresholding, which can be expressed by  
\[\lambda=\sigma\sqrt{2\log n} \tag{18}\]  
where \(n\) is the length of the wavelet coefficients, and \(\sigma\) is the signal standard deviation. 2.3.4. Principle of the Coarse-to-Fine Machining Error Decomposition Method  
To accurately decompose the free-form surface machining error, a coarse-to-fine machining error decomposition method is proposed in this paper. The goal of this method is to combine the VMD algorithm, EMD algorithm and wavelet thresholding method, sort the algorithms by considering their characteristics and decompose the processing errors according to the order of the algorithms. The specific steps of its decomposition are as follows:  
1. Let the original machining error be \(x=\{x_{1},x_{2},x_{3},\cdots,x_{n}\}\), and use VMD to coarsely decompose the machining error to obtain \(K\) components of IMFs of length \(n\), which can be expressed by \[x=\sum\limits_{k=1}^{K}\mathrm{IMF}k\] (19)  
The correlation coefficients between each of the IMF components and the original machining error are calculated separately to obtain a series of correlation coefficients \(r_{i}\), which can be expressed by  
\[r_{i}=\frac{\sum\limits_{i=1}^{n}{(x_{i}-\overline{x})(\mathrm{IMF}_{i}- \overline{\mathrm{IMF}})}}{\sqrt{\sum\limits_{i=1}^{n}{(\mathrm{IMF}_{i}- \overline{\mathrm{IMF}})^{2}}}\sqrt{\sum\limits_{i=1}^{n}{(x_{i}-\overline{x} )^{2}}}} \tag{20}\]  
The IMF components with absolute correlation coefficients greater than the thresholding set for the correlation coefficients are filtered out and reconstructed to obtain the crude systematic error \(X_{1}\) after VMD. 2. EMD is utilized to perform a fine decomposition of the coarse systematic error \(X_{1}\) after VMD into \(M\) IMF components and a trend term, which can be expressed by \[X_{1}=\sum_{m=1}^{M}\text{IMF}m+\text{res}\] (21)  
The correlation coefficient between each IMF component obtained from the refined decomposition and the original processing error is calculated. Based on the correlation coefficients, the IMF components that are larger than the thresholding of the set correlation coefficient are filtered out and reconstructed to obtain the systematic error \(X_{2}\). 3. The IMF components with correlation coefficients of less than 0.3 in the VMD coarse decomposition and EMD fine decomposition processes may also contain a small systematic error.