## 3 Vibration Active Control
### Adaptive Algorithms
#### 3.1.1 Least-Mean Square (LMS) Algorithm  
The least mean square (LMS) algorithm is one of the most commonly used adaptive filtering algorithms due to its computational simplicity, ease of proving its efficiency in stationary environments, stable behavior when implemented with finite arithmetic precision, and because it does not need to estimate the approximation gradient of values offline [29; 31]. The use of adaptive learning algorithms with statistical inference allows for estimating the behavior of systems that present characteristics that can change over time, as is the case of signals from hand tremors.  
Figure 2 shows a diagram that helps in understanding the LMS. The vector \(\mathbf{x}=(x_{0},x_{1},\ldots,x_{n})\) represents the system input values, the vector \(\mathbf{w}=(w_{0},w_{1},\ldots,w_{n})\) refers to the weights of the algorithm, which are updated at each iteration, and \(y(n)\) represents the output estimated by the weights and the input by  
\[y(n)=\mathbf{x}^{\top}(n)\,\mathbf{w}(n). \tag{3}\]  
The signal \(d(n)\) is the signal to be approximated by the output \(y(n)\) of the system, and \(e(n)\) represents the value of the error at instant \(n\).  
Thus,  
\[e(n)=d(n)-y(n) \tag{4}\]  
and therefore,  
\[e(n)=d(n)-\mathbf{x}^{\top}(n)\,\mathbf{w}(n) \tag{5}\]  
Taking the square value of the error (5) in order to minimize it, yields  
\[\begin{split} e^{2}(n)=d^{2}(n)&-2\,d(n)\,\mathbf{x }^{\top}(n)\,\mathbf{w}(n)\\ &+\mathbf{x}(n)\,\mathbf{w}^{\top}(n)\,\mathbf{w}(n)\,\mathbf{x }^{\top}(n).\end{split} \tag{6}\]  
Figure 2: Weight diagram of the LMS algorithm [26].  
The mean square error (MSE) is obtained from the calculation of the mean operator, \(E[.]=\xi(n)\), in (6),  
\[\xi(n)=E[d^{2}(n)] -2\,E[d(n)\mathbf{x}^{\top}(n)]\mathbf{w}(n) \tag{7}\] \[+\mathbf{w}^{\top}(n)E[\mathbf{x}(n)\mathbf{x}^{\top}(n)]\mathbf{w }(n)\]  
or  
\[\xi(n)=E[d^{2}(n)]-2\,\mathbf{p}_{xd}^{\top}(n)\,\mathbf{w}(n)+\mathbf{w}^{ \top}(n)\mathbf{R}_{xx}\mathbf{w}(n) \tag{8}\]  
where \(\mathbf{p}_{xd}=E[d(n)\mathbf{x}(n)]\) is the cross-correlation vector of input and output signals and \(\mathbf{R}_{xx}=E[\mathbf{x}(n)\mathbf{x}^{\top}(n)]\), known as the deterministic autocorrelation matrix of the input signal. It is observed that from (8), the MSE is given as a function of the weights, so the weights must be adjusted to reduce the error. This weight adjustment falls on a negative gradient in the decay rate of the root mean square error with respect to the weight adjustment, as shown by applying the derivative to (7),  
\[\frac{d\xi(n)}{d\mathbf{w}(n)}=-2d(n)\mathbf{x}(n)+2\mathbf{x}(n)\mathbf{x}^{ \top}(n)\mathbf{w}(n)=\
abla(n) \tag{9}\]  
and  
\[\
abla(n)=-2\mathbf{x}(n)[d(n)-\mathbf{x}^{\top}(n)\mathbf{w}(n)]. \tag{10}\]  
Substituting Equation (5) into Equation (10), we have  
\[-\
abla(n)=2\,\mathbf{x}(n)\,e(n) \tag{11}\]  
The matrix \(\mathbf{R}_{xx}\) is a positive definite matrix and the solution, \(\mathbf{w}_{o}\), which minimizes the MSE, commonly known as the Wiener solution, is given by  
\[\mathbf{w}_{o}=\mathbf{R}_{xx}^{-1}(n)\mathbf{p}(n). \tag{12}\]  
The weight update equation for the LMS algorithm is given by  
\[\mathbf{w}(n+1)=\mathbf{w}(n)+\mu[-\
abla(n)]. \tag{13}\]  
where \(\mu\) is the adaptation step of the algorithm. The smaller this adjustment, the more precise the adaptation; however, a very small value of \(\mu\) can result in a slower response of the adaptation system due to the high number of points.  
Substituting the values of (11) in (13) yields  
\[\mathbf{w}(n+1)=\mathbf{w}(n)+\mu\mathbf{x}(n)e(n). \tag{14}\]