## 4 Preparation of EEG Signals for Double Filtering and Classification: Preclassification Part
### EEG Signal Filtering Method and its Spectral Presentation for Motion Command Detection  
As per Section 3, the raw signal from all 32 channels was filtered. This was necessary for this project, because the signal without proper filtering is difficult to analyze. The example in Figure 5 shows how unfiltered waveforms stabilize for a long time before reaching a steady = state voltage. The authors implemented an algorithm that enabled high-pass filtering. The sampling frequency was \(f_{\mathrm{S}}=1000\) Hz and the bandwidth was \(f_{\mathrm{B}}=150\) Hz. Figure 5 shows the final form of the filtered signal. The literature describes various ways of classifying EEG signals, including spectral analyses and various types of filtering. However, there is still no extensive collection of studies using the Emotiv EPOC Flex Gel headset compared to other sets of this company. Figure 4: Data acquisition, analysis and classification system. Figure 5: The observation of raw and filtered EEG signals. Thus, methods for using this product for the design of BCI systems, signal processing and measurement classification methods are constantly being developed. The signal sampling frequency by the dedicated application was \(f_{E}=128\) Hz. The authors decided to generate a power spectrum of one-second signal samples for each of the 4 channels separately (F7, Fp1, F8, Fp2). It was therefore possible to unequivocally assess the actual state that took place in this period of time. We formulated Equation (1) to represent the number of samples per signal. Using the \(S\) variable, we could express the number of one-second spectral verification samples that were allocated to the entire measurement. The \(V\) variable was a presentation of the number of all samples included in the measurement. The signal sampling frequency was described by a variable \(f_{E}\). \[S=\frac{V}{f_{E}}, \tag{1}\]  
Taking a 15 s signal of \(V=1920\) samples as an example as represented in Equation 1, the result was \(S=15\). However, substituting a 20.5 s signal with \(V=2624\) samples in the same formula resulted in \(S=20\) as only full one-second periods of electroencephalographic samples were taken into account. This was due to concern for unambiguous results. The \(S\) result was necessary for use in Equation (2). It is worth paying attention to the method of collecting data resulting from the spectral analysis of one-second EEG signals. After the Equation (2) analysis, it can be observed that the obtained spectral results for the four selected electrodes (F7, Fp1, F8 and Fp2) were placed in the \(\mathbf{K}\) matrix with dimensions \(i=4\) and \(j=129\). It consisted of four one-dimensional vectors. In each of them, there was the result of the applied operation under the vector \(PS\) of size \(j\). \[\mathbf{K}= \begin{bmatrix}\mathbf{K_{1}}\\ \mathbf{K_{2}}\\ \mathbf{K_{3}}\\ \mathbf{K_{4}}\end{bmatrix} = \begin{bmatrix}PS_{1}^{(1)}\dots PS_{129}^{(1)}\\ PS_{1}^{(2)}\dots PS_{129}^{(2)}\\ PS_{1}^{(3)}\dots PS_{129}^{(3)}\\ PS_{1}^{(4)}\dots PS_{129}^{(4)}\end{bmatrix} . \tag{2}\]  
As a result of the operation of obtaining the power spectrum of a one-second signal of 4 electrodes, the results of which were in the \(\mathbf{K}\) matrix, a relationship could be formulated according to which they could be collected into the matrix and then transferred to the neural network. Hence, Equation (3) was formulated. Analyzing this relationship, it can be concluded that the \(\mathbf{L}\) matrix was the set of transpositions of the \(\mathbf{K}\) matrix arranged in one column for a one-second sample of signals. Hence, it was known that the dimensions of \(\mathbf{L}\) were 516 lines and \(S\) columns. In this form, it was transferred to the artificial intelligence module in an expert system. \[\mathbf{L}_{(\mathbf{1}\dots\mathbf{S})}= \begin{bmatrix}\mathbf{K_{1}}(1 \dots j)^{\mathbf{T}}\\ \mathbf{K_{2}}(1\dots j)^{\mathbf{T}}\\ \mathbf{K_{3}}(1\dots j)^{\mathbf{T}}\\ \mathbf{K_{4}}(1\dots j)^{\mathbf{T}}\end{bmatrix} .