## 3 Signal Processing While Drilling
### Signal Filtering and Denoising  
In the drilling process, the collected signals often contain noise, which can obscure useful information and adversely affect subsequent feature extraction and model training. This section uses vibration signals as an example to discuss the principles and processes of noise reduction in these signals. The most common denoising methods for mechanical vibration signals include filters and wavelet denoising, with nonlinear wavelet transform threshold denoising being the most frequently employed technique. In this paper, the wavelet analysis toolbox in MATLAB (R2022a) is utilized to denoise the vibration signals. A noisy one-dimensional signal model can be represented in the following form:  
\[s(k)=f(k)+\varepsilon\cdot e(k),k=0,1,\cdots,n-1 \tag{3}\]  
Among these signals, s(k) represents a noisy signal, f(k) denotes a useful signal, and e(k) is another noisy signal. e(k) is characterized as level 1 Gaussian white noise, typically appearing as a high-frequency signal. In practical engineering applications, f(k) is generally a low-frequency signal or a relatively stable signal. Consequently, we can implement noise reduction processing as follows. The wavelet transform filters the original time series signal using both low-pass and high-pass filters to obtain the corresponding low-frequency and high-frequency components. The low-frequency component represents the primary characteristics of the original signal, capturing its overall trend, while the high-frequency component contains the details or variations of the signal, often reflecting short-term fluctuations. Firstly, the signal s(t) is transformed by wavelet denoising. Wavelet transform decomposes the signal into wavelet coefficients with different scales and frequencies, which are expressed as follows:  
\[s(t)=\sum_{j=0}^{J-1}\sum_{k}c_{j,k}\phi_{j,k}(t)+\sum_{j=0}^{J-1}\sum_{k}d_{j,k }\psi_{j,k}(t) \tag{4}\]  
where cj,k are approximate coefficients, dj,k are detail coefficients, and \(\Phi_{\text{j,k}}\) (T) and \(\psi_{\text{j,k}}\) (T) denote wavelet function and wavelet base, respectively. Next, the wavelet coefficients are threshold processed. Threshold processing compares the amplitude of wavelet coefficients and determines whether to set them to zero or retain them according to the set threshold parameters. The commonly used threshold processing methods include hard threshold and soft threshold. For the hard threshold method, the threshold processing formula is as follows:  
\[\hat{c}_{j,k}= \begin{cases}c_{j,k},&\mid c_{j,k}\mid>T\\ 0,&\mid c_{j,k}\mid\leqslant T\end{cases}  \tag{5}\]  
\[\hat{d}_{j,k}= \begin{cases}d_{j,k},&\mid d_{j,k}\mid>T\\ 0,&\mid d_{j,k}\mid\leqslant T\end{cases}  \tag{6}\]  
For the soft threshold method, the threshold processing formula is as follows:  
\[\hat{c}_{j,k}=sgn(c_{j,k})(\mid c_{j,k}\mid-T)_{+} \tag{7}\]  
\[\hat{d}_{j,k}=sgn(d_{j,k})(\mid d_{j,k}\mid-T)_{+} \tag{8}\]  
where SGN (\(\cdot\)) represents a symbolic function, and the positive part is represented by (s)\({}_{+}\) = max (0, x). Finally, the denoised signal \(\delta\)(T) is obtained by inverse wavelet transform of the processed wavelet coefficients. \[\delta(t)=\sum_{j=0}^{J-1}\sum_{k}\hat{c}_{j,k}\phi_{j,k}(t)+\sum_{j=0}^{J-1} \sum_{k}\hat{d}_{j,k}\psi_{j,k}(t) \tag{9}\]  
The wavelet denoising of the rock vibration signal is completed by MATLAB. The original vibration signal is preprocessed as the real value of the vibration signal. According to the characteristics of the vibration signal, the decomposition layers with the best denoising effect are determined. The rock vibration signal is denoised by selecting the wavelet basis and continuously adjusting the decomposition layers and other parameters.