## 4 Inverse Calculation for Acoustic Impedance of Ventilation Cloth
The particle positions and velocities have to be updated continuously during particle movement as follows:  
\[x_{i}^{k+1}=x_{i}^{k}+v_{i}^{k+1} \tag{9}\]  
\[v_{i}^{k+1}=\omega v_{i}^{k}+c_{1}r_{1}^{k}\left(p_{i}^{k,best}-x_{i}^{k} \right)+c_{2}r_{2}^{k}\left(g_{i}^{k,best}-x_{i}^{k}\right) \tag{10}\]  
where \(x_{i}^{k+1}\) is the position of the \(i\)th particle at the (\(k+1\))th iteration (new position), \(x_{i}^{k}\) is the position at the \(k\)th iteration (original position), \(v_{i}^{k+1}\) is a new velocity, \(v_{i}^{k}\) is the original velocity, \(\omega\) is the inertia weight, \(c_{1}\) is the empirical weight of the particle, \(c_{2}\) is the empirical weight of the group, and \(r_{1}^{k}\) and \(r_{2}^{k}\) are the random variables between 0 and 1. The random variables change randomly with each iteration, representing the random directions of particles and groups, respectively. Moreover, \(p_{i}^{k,best}\) is the best solution of \(i\)th particle at the \(k\)th iteration, and \(g_{i}^{kbest}\) is the \(k\)th best solution of the group. The best solution can be judged by the following formula  
\[\left( \begin{array}{l}g_{i}^{k,best}=p_{i}^{k,best}f\left(p_{i}^{k,best},f \right)<J\left(g_{i}^{k,best},f\right)\\ p_{i}^{k,best}=x_{i}^{k}\quad J\left(x_{i}^{k},f\right)<J\left(p_{i}^{k,best},f \right)\end{array} \right. \tag{11}\]  
The \(R_{ap}\) of 10 commonly used ventilation cloths were estimated their \(R_{ap}\) in this work. These ventilation cloths were sub grouped into two categories viz. (1) Non-woven (NW-1 to NW-5, varying in thicknesses) and (b) Meshed (M-250 to M-450, varying in number of meshes). The details of all 10 ventilation cloths are provided in Tables 2 and 3 (non-woven and meshed ventilation cloths, respectively). As aforementioned, the acoustic resistances of all ventilation cloths were estimated by inverse calculation. The ventilation cloths were glued over the vents to the rear side of the microspeaker (Figure 1d), and the frequency response curves were obtained by anechoic chamber measurements. The measured curves were set as a target function in the PSO implementation to estimate the acoustic resistance. The built-in function \"particleswarm\" in MATLAB software [43] was used to execute the PSO algorithm. The syntax of the MATLAB \"particleswarm\" in-built function was \"\(x\) = particleswarm(fun,nvars,lb,ub,options)\" to attempts to find a vector \"\(x\)\" that achieves a local minimum of \"fun\" for the given number of design variables \"nvars\". The \"lb\" and \"ub\" are the set of lower (0.01) and upper bounds (20) on the design variables (\(x\)) to find a solution in the range (lb \(\leq x\leq\) ub). \"Options\" include the default optimization parameters. The PSO consists of seven steps. Step 1 confirms the known parameters (T/S parameters) and target curve (\(SPL_{m}\)). Step 2 establishes an ECM model and defines a \"particle swarm\" (parameter) to be optimized in the model. Step 3 uses a random number function to initialize the particle's position and velocity (say \(k\) = 0, for the first iteration). The particle solution \(x_{i}^{k+1}\) is substituted into the ECM in Step 4 to calculate \(SPL_{s}\). Further, the objective function is used to evaluate \(p_{i}^{k,best}\). Step 5 updates the velocity and position of each particle group by updating the particle's velocity \(v_{i}^{k+1}\) and substituting it to obtain updated position \(x_{i}^{k+1}\). In Step 6, the updated position \(x_{i}^{k+1}\) is used to obtain \(g_{i}^{k,best}\) and \(p_{i}^{k,best}\). Step 7 tests the convergence. If the convergence is derived, then the best particle swarm solution is provided. Otherwise, the process is repeated from Step 4. Thus, the best value of acoustic resistances of all ventilation cloths is determined separately. In this work, the number of iterations was used as the condition for the termination of the calculations.