# Research on CNC Machine Tool Spindle Fault Diagnosis Method Based on DRSN-GCE Model
## 2 Methods  
### Continuous Wavelet Transform  
The Continuous Wavelet Transform is a technique for signal processing that analyzes the frequency characteristics in signals with irregular frequencies or variable frequencies. Comparing with traditional frequency-domain methods such as the Discrete Fourier Transform (DFT), CWT provides global frequency information and localized insights by examining the signal in both time and frequency domains. This makes it particularly effective for capturing transient or short-lived signal features. The core concept of CWT involves generating a series of wavelet basis functions by scaling and translating a fundamental wavelet that is known as the \"mother wavelet\". By convolving these wavelets with the input signal, CWT produces wavelet coefficients that encapsulate the signal's characteristics across different scales (frequencies) and time intervals. The coefficients allow a detailed study of the evolution over time of the frequency content in a signal. The mathematical expression for the continuous wavelet transform is shown below:  
\[\text{CWT}_{f}(a,b)=\frac{1}{\sqrt{|\mathbf{a}|}}\int_{-\infty}^{+\infty}f(t) \,\varphi^{*}\left(\frac{t-b}{a}\right)rd \tag{1}\]  
where \(f(t)\) denotes the original signal, \((t)\) denotes the wavelet function, and \(a\) and \(b\) are the scale and position parameters, respectively. The frequency range of the wavelet function can be changed by adjusting the scale \(a\), while the position parameter \(b\) controls the movement of the wavelet on the time axis.  
In continuous wavelet transform, wavelet basis function is the basic function used to analyze the signal with localization properties in time and frequency domains. The wavelet basis function is expressed as follows:  
\[\varphi_{a,b}(t)=\frac{1}{\sqrt{a}}\,\varphi\left(\frac{t-b}{a}\right) \tag{2}\]  
where \(\varphi(t)\) denotes the mother wavelet, which is the basic wavelet form after scaling and panning; \(a\) is a scale parameter that controls the width and frequency of the wavelet function, while \(b\) is a panning parameter, which determines the position of the wavelet on the time axis. By adjusting these two parameters, the signal can be analyzed locally at different scales and positions to extract the time-frequency characteristics of the signal.  
In the continuous wavelet transform, an appropriate wavelet basis function is essential for accurate signal features. Commonly used wavelet basis functions include the Morlet wavelet, Haar wavelet, Daubechies wavelet, and Mexican Hat wavelet. Among these, the Morlet wavelet is widely favored in bearing fault diagnosis due to its smoothness, symmetry, and effective modulation with accurate fault features in both frequency and time domains. Therefore, Morlet is chosen as the wavelet basis function in this paper, and its function expression is as follows:  
\[\varphi_{\text{m}}(t)=\pi^{-1/4}\mathrm{e}^{\mathrm{i}\omega_{0}t}\mathrm{e}^ {-t^{2}/2} \tag{3}\]  
where \(\omega_{0}\) is the corner frequency parameter that controls the frequency of the waveform; and \(\mathrm{j}\) is an imaginary unit.  
The signal containing noise is preprocessed by CWT to convert one-dimensional time-series signals into two-dimensional time-frequency images, which provides rich input data information for the deep learning model so that the model can better extract time-frequency features of faults and improve the accuracy of diagnosis. Since CWT is able to locally analyze the signal that contains noise, the deep learning model can still extracteffective features from the time-frequency image for noise immunity and high diagnostic performance in noisy environments. For the time-frequency image provided by CWT to contain rich feature information, it enables better captured features of different types of faults and improves the generalization ability to unknown data.