## 6 Unlocking the Power of Wavelet Transforms  
It decomposes a signal into components at different frequency scales, making it easier to identify and remove artifacts in EEG signals. The continuous wavelet transform (CWT) of a signal \(x(t)\) is defined as the convolution of \(x(t)\) with a family of wavelet functions \(\Psi_{a,b}(t)\), which are derived from a parent function \(\Psi(t)\) through dilation and translation operations. Dilation is controlled by the parameter \(a\), which regulates the scale or frequency of the wavelet, while translation is determined by the parameter \(b\), which regulates the temporal position of the wavelet. The CWT is expressed as [100, 101]:  
\[W(a,b)=\frac{1}{\sqrt{|a|}}\int_{-\infty}^{+\infty}x(t)\Psi^{*}\Big{(}\frac{t- b}{a}\Big{)}dt \tag{5}\]  
where \(W(a,b)\) represents the wavelet coefficient at scale \(a\) and position \(b\), and \(\Psi^{*}\) is the complex conjugate of the wavelet function. This transformation produces a two-dimensional representation of the original signal in terms of scale and time, allowing for detailed analysis of its frequency components over time. For practical analysis of EEG signals and removal of artifacts, the discrete wavelet transform (DWT), which is a sampled version of the CWT, is most frequently used. DWT operates through a series of filtering and subsampling operations, exploiting the decomposition of the signal into a combination of wavelet functions, each corresponding to a specific frequency scale and temporal position. This process takes advantage of the ability of wavelets to offer a multi-resolution representation of the signal, isolating specific characteristics at different scales. Let \(x(t)\) be the EEG signal from which to remove the artifacts. The choice of a parent wavelet \(\Psi(t)\) is crucial, since it determines the properties of the wavelet functions generated for the decomposition. The mother wavelet is a function that satisfies certain conditions, including zero integration (which ensures its oscillating nature) and rapid decay towards zero (which ensures temporal and frequency localization). In the DWT, \(x(t)\) is iteratively processed to separate it into high- and low-frequency components via high-pass (\(h[n]\)) and low-pass (\(l[n]\)) filters, with \(n\) decomposition level. At each iteration or level, the signal is decomposed as follows:  
* Detail components \(d[n]\), which are obtained by filtering \(x(t)\) with \(h[n]\) and represent high-frequency information or rapid variations in the signal;
* Components of approximation \(a[n]\), which are obtained by filtering \(x(t)\) with \(l[n]\) and contain low-frequency information or the general trend of the signal. The decomposition of \(x(t)\) can be mathematically expressed by  
\[d[n] =\sum_{k}h[k-2n]\cdot x[k] \tag{6}\] \[a[n] =\sum_{k}l[k-2n]\cdot x[k]. \tag{7}\]  
After applying filters, the signal is downsampled by a factor of 2, reducing the size of the signal for the next level of decomposition. Artifacts, being unwanted components often localized in specific frequency bands, can manifest as high-frequency variations and therefore be captured in the \(d[n]\) detail components. By identifying these components and removing or modifying them, artifacts can be eliminated from the signal. After the removal of the detail components corresponding to the artifacts, the reconstruction of the clean EEG signal occurs through the inverse process of the DWT, combining the residual approximation components with the modified or filtered details. The reconstruction formula involves combining the upsampled and re-filtered series with \(h[n]\) and \(l[n]\) to obtain the original signal without the artifacts:  
\[x^{\prime}[k]=\sum_{n}h^{\prime}[k-2n]\cdot d^{\prime}[n]+\sum_{n}l^{\prime}[k-2n ]\cdot a[n]. \tag{8}\]  
The choice of the mother wavelet is based on the types of artifacts and the characteristics of the signal.