## 2 Proposed PSO-Based ANC System with Switching Filter Selection
The mean squared error (MSE) of each \(P\) error signal, which represents the fitness function of each adaptive filter, is used by two PSO algorithms to determine the best position. Here, the fitness value \(f_{i}\) of the position \(\mathbf{w}\) can be obtained as follows: \[f_{i}(n)=\frac{1}{N}\sum_{k=1}^{T}e_{i}^{2}(k)\] (4) where \(T\) depicts the total number of iterations
* _Select the best performance_. As can be observed from Figure 3, the proposed ANC system is composed of two PSO algorithms (\(PSO_{1}\) and \(PSO_{2}\)). Here, each particle of the PSO algorithms has a position \(\mathbf{w}\) and a velocity \(\mathbf{v}\). Equations (5) and (6) are used to update these parameters as follows: \[\mathbf{v}_{j,i}(n)=\phi_{j}\cdot\mathbf{v}_{j,i}(n-1)+c_{1}\cdot r_{1}[ \mathbf{w}_{pbest_{j,i}}-\mathbf{w}_{j,i}(n)]+c_{2}\cdot r_{2}[\mathbf{w}_{ ghost}-\mathbf{w}_{j,i}(n)]\] (5) \[\mathbf{w}_{j,i}(n)=\mathbf{w}_{j,i}(n-1)+\mathbf{v}_{j,i}(n)\] (6) where \(c_{1}\) and \(c_{2}\) are the acceleration coefficients, \(r_{1}\) and \(r_{2}\) are the vectors of random numbers of length \(N\), \(\mathbf{w}_{pbest}\) and \(\mathbf{w}_{gbest_{j,i}}\) are the personal best position and global best position, respectively, and \(\phi_{j}\) is the inertia weight. In addition, \(r_{1}\) and \(r_{2}\) are defined in the interval [0, 1] and the inertia weight can be obtained as follows: \[\phi_{j}=\phi_{j_{max}}-\frac{t\cdot(\phi_{j_{max}}-\phi_{j_{min}})}{T}\] (7) To select between two PSO algorithms (\(PSO_{1}\) and \(PSO_{2}\)), we propose a selection criteria based on the evaluation of past samples of the error signal to verify significant changes in the MSE level. Equations (8) and (9) are used to evaluate the past samples of the error as follows: \[\gamma_{1}=|e_{gbest}^{2}(n-1)-e_{gbest}^{2}(n-2)|\] (8) \[\gamma_{2}=|e_{gbest}^{2}(n)-e_{gbest}^{2}(n-1)|\] (9) Hence, the updates of the position and velocity of each PSO algorithm are ruled by the following equations: \[\mathbf{w}_{1,i}(n)=\left\{ \begin{array}{ll}\mathbf{w}_{1,i}(n-1)+\mathbf{v }_{1,i}(n),&\text{if }\gamma_{1}\geq k_{1}\text{ and }\gamma_{2}\leq k_{2}\\ \mathbf{w}_{2,i}(n),&\text{otherwise}\end{array} \right.\] (10) \[\mathbf{v}_{1,i}(n)=\phi_{1}\cdot\mathbf{v}_{1,i}(n-1)+c_{1}\cdot r_{1}[ \mathbf{w}_{pbest_{1,i}}-\mathbf{w}_{1,i}(n)]+c_{2}\cdot r_{2}[\mathbf{w}_{ gbest}-\mathbf{w}_{1,i}(n)]\] (11)\[\mathbf{w}_{2,i}(n)=\left\{ \begin{array}{ll}\mathbf{w}_{1,i}(n),&\text{if }\gamma_{1}\geq k_{1}\text{ and }\gamma_{2}\leq k_{2}\\ \mathbf{w}_{2,i}(n-1)+\mathbf{v}_{2,i}(n),&\text{otherwise}\end{array} \right. \tag{12}\]  
\[\mathbf{v}_{2,i}(n)=\phi_{2}\cdot\mathbf{v}_{2,i}(n-1)+c_{3}\cdot r_{1}[ \mathbf{w}_{pbest_{j,i}}-\mathbf{w}_{2,i}(n)]+c_{4}\cdot r_{2}[\mathbf{w}_{ gbest}-\mathbf{w}_{2,i}(n)] \tag{13}\]  
where \(k_{1}<k_{2}\), \(k_{1}\) is a small number close to zero, and \(k_{2}\) is chosen by trial and error [23]. In general, Equations (10) and (12) indicate when the PSO algorithms are updated. If the degree of change of the MSE level is larger than \(k_{1}\), the \(PSO_{1}\) algorithm must be updated and transfer its coefficients to the \(PSO_{2}\) allowing the system to update only one algorithm at a time. On the other hand, if according to Equation (12), \(PSO_{2}\) must be updated, the new coefficients are transferred to \(PSO_{1}\). With the proposed scheme, a fast convergence speed using \(PSO_{1}\) algorithm is attained, and the MSE level is reduced by employing \(PSO_{2}\) algorithm. * _Update the personal and global best position._ In this step, two variables are selected, the first one is called personal best position, \(\mathbf{w}_{pbest_{j,i}}(n)\). To find the value of \(\mathbf{w}_{pbest_{j,i}}(n)\), we perform a comparison between the current value of \(f_{i}(n)\) and the value of \(f[\mathbf{w}_{pbest_{j,i}}(n-1)]\) as follows: \[\mathbf{w}_{pbest_{j,i}}(n)=\left\{ \begin{array}{ll}\mathbf{w}_{j,i}(n),& \text{if }f_{i}[\mathbf{w}_{j,i}(n)]<f[\mathbf{w}_{pbest_{j,i}}(n-1)]\\ \mathbf{w}_{pbest_{j,i}}(n-1),&\text{otherwise}\end{array}