## 2 Materials and Methods
### Signal Processing Applied to the Classification of Relaxation State
This process combines the approximation coefficients \(cA_{2,k}\), with the attenuated detail coefficients \(cD_{1,k}^{soft}\) and \(cD_{2,k}^{soft}\) to produce the smoothed signal:\[\tilde{S}=IDWT\left(cA_{2,k},cD_{1,k}^{soft},cD_{2,k}^{soft}\right) \tag{13}\]  
The symbol \(\tilde{S}\) represents the reconstructed signal, improved by the noise reduction process. Filtering signals with a Butterworth filter (8-13 Hz): A fifth-order bandpass Butterworth filter with a cutoff range of 8 to 13 Hz was used for EEG signal filtering. The general equation that describes the amplitude response of a Butterworth filter is as follows [27]:  
\[|H(jw)|=\frac{K}{\left[1+\left(\frac{s}{w_{1}}\right)^{2n}\right]^{1/2}} \tag{14}\]  
In this context, \(n\) represents the filter order as a positive integer, \(w_{1}\) denotes the filter's \(-3\) dB cutoff frequency, and \(K\) indicates the filter's gain. Application of the Fast Fourier Transform (FFT): The Fast Fourier Transform (FFT) is a highly efficient algorithm used to compute the Discrete Fourier Transform (DFT) and its inverse. The DFT is essential for converting signals from the time domain to the frequency domain, enabling the analysis of frequency components within a signal. The following formula represents this transformation:  
\[X(m)=\sum_{n=0}^{N-1}x[n]e^{-j\frac{2 nm}{2N}},\ m=0,\ \ldots,N-1 \tag{15}\]  
* \(X(m)\) is the complex value representing the frequency component of the transformed signal. * \(x[n]\) is the value of the signal in the time domain at sample \(n\). * \(N\) is the total number of samples in the signal. * \(m\) is the index of the frequency component. * \(j\) is the imaginary unit. In the DFT, \(N\) terms must be calculated for each value of \(m\) that can range from 0 to \(N-1\). Therefore, the total number of operations grows proportionally to \(N^{2}\), resulting in a complexity of \(O(N^{2})\). FFT optimizes the calculation of the DFT by dividing the problem into smaller subproblems and combining the results, reducing the operations from \(O(N^{2})\) to \(O(NlogN)\). Fast Fourier Transform (FFT) can provide frequency information without a temporal reference, concealing frequency changes over time. To address this limitation, the signal was segmented, and the FFT was applied to each segment. This approach enabled the extraction of the frequency spectrum associated with each time interval. Specifically, the FFT was utilized to obtain the frequency spectrum for each segment:  
\[X_{k}(m)=FFT(x_{k}[n])=\sum_{n=0}^{N-1}x_{k}[n]e^{-j\frac{2 nm}{2N}} \tag{16}\]  
* \(x_{k}[n]\) represents a specific segment of the original signal. * \(X_{k}(m)\) is the result of the FFT applied to segment \(k\), which takes values corresponding to the different segments, specifically \(k=0,\ 1,\ 2,\ldots,K-1\), where \(K\) represents the total number of segments analyzed. The matrix \(\mathbf{X}\) resulting from applying the FFT to the segments of the signal is organized as follows:  
\[\mathbf{X}= \begin{bmatrix}X_{0}(0)&X_{0}(1)&X_{0}(2)&\cdots&X_{0}(N-1)\\ X_{1}(0)&X_{1}(1)&X_{1}(2)&\cdots&X_{1}(N-1)\\ X_{2}(0)&X_{2}(1)&X_{2}(2)&\cdots&X_{2}(N-1)\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ X_{K-1}(0)&X_{K-1}(1)&X_{K-1}(2)&\cdots&X_{K-1}(N-1)\end{bmatrix}  \tag{17}\]  
\(K\) is an integer indicating how many segments (or windows) have been created from the signal \(x[n]\). Numerical integration using the trapezoidal rule: The chosen measurement method for obtaining a characteristic value that distinguishes between relaxed and active states was approximating the area under the spectrum curve in the 8 to 13 Hz range using the trapezoidal rule:  
\[\mathrm{A}\approx\frac{\mathrm{h}}{2}\left(\mathrm{f(x_{0})}+2\sum_{i=1}^{n-1} \mathrm{f(x_{i})}+\mathrm{f(x_{n})}\right) \tag{18}\]  
* A is the sum that approximates the area under the curve in the interval \([\mathrm{a},\ \mathrm{b}]\) using a series of discrete points \(\mathrm{x_{0}},\ \mathrm{x_{1}},\ \dots,\ \mathrm{x_{n}}\).