# Design of Adaptive Kalman Consensus Filters (a-KCF)
## 4 Adaptive Kalman Consensus Filtering
We now can write the collective Lyapunov function as follows:  
\[ \begin{array}{l}V=\sum_{i=1}^{n}V_{i}=\sum_{i=1}^{n}e_{i}^{T}\Pi_{i}^{-1}e_ {i}+\sum_{i=1}^{n}\sum_{j\in N_{i}}\gamma_{ij}^{2}\\ =\sum_{i=1}^{n}e_{i}^{T}\Pi_{i}^{-1}e_{i}+tr(\Gamma^{T}\Gamma)\end{array} . \tag{18}\]  
We denote \(\mathbb{D}=diag(\Pi_{1},...,\Pi_{n})\), where each entry in \(\mathbb{D}\) is a symmetric positive definite solution of Equation (7) with respect to a different index \(i\). Now, we can use the collective error dynamics to represent \(V\) in Equation (18) as follows:  
\[V=\mathbb{E}^{T}\mathbb{D}\mathbb{E}+trace(\Gamma^{T}\Gamma). \tag{19}\]Then, we take the derivative of \(V\) and combine it with the adaptation law in Equation (11), resulting in the following expression:  
\[\dot{V}=\mathbb{E}^{\mathsf{T}}(\mathbb{M}^{\mathsf{T}}\mathbb{D}^{-1}+\mathbb{D} ^{-1}\mathbb{M})\mathbb{E}=-\mathbb{E}^{\mathsf{T}}\Omega\mathbb{E}\leq 0 \tag{20}\]  
where \(\Omega=diag(\Omega_{1},...,\Omega_{n})\) and each entry of \(\Omega\) must satisfy Equation (7) for the corresponding \(i\)th index. Therefore, we can argue that the collective error dynamics \(\mathbb{E}\) and \(\Gamma\) from Equation (20) are bounded; thus, we can say that \(\mathbb{E}\in L_{2}\cap L_{\infty}\). From Equation (16), it can be concluded that \(\mathbb{E}\) is bounded as well, that is, \(\mathbb{E}\in L_{\infty}\). Therefore, using [PERSON]'s Lemma, we can write \(\mathbb{E}\to 0\) as \(t\rightarrow\infty\); in other words, the error dynamics of each agent asymptotically converge to zero. ```
1:Initialize: \(\hat{x}_{i}(0)=x(0)\), \(\hat{P}_{0}=P_{0}\), \(e_{i}0=e(0)\). 2:Compute the weighted consensus matrix: \(W_{i}=\Pi_{i}C_{i}^{\mathsf{T}}C_{i}\), where \(\Pi_{i}\) is a symmetric positive definite matrix that satisfies the Equation (7). 3:Compute the Kalman gain: \(K_{i}\)=\(P_{i}C_{i}^{T}R_{i}^{-1}\), and \(K_{i}\) satisfies to generate an exponentially stable local system. 4:Compute the adaptive gain: \(\gamma_{ij}=-(C_{i}e_{i})^{\mathsf{T}}C_{i}(\hat{x}_{j}-\hat{x}_{i})\)
5:Compute the estimated state: \(\hat{x}_{i}(t)=A_{i}\hat{x}_{i}(t)+K_{i}y_{i}(t)+W_{i}\sum_{j\in N_{i}}\gamma_ {ij}(t)(\hat{x}_{j}(t)-\hat{x}_{i}(t))\)
6:return\(\hat{x}_{i}\)
```  
**Algorithm 1** Adaptive Kalman Consensus Filter  
Special case: when the adaptive gain \(\gamma_{ij}=\gamma_{i}\)  
If we assume that the adaptive gains \(\gamma_{ij}\) for all neighbors of the \(i\)th agent are identical, such that \(\gamma_{ij}=\gamma_{i},\forall j\in N_{i}\). Then, we can take the \(\gamma_{ij}\) term out of the summation in Equation (4); in this manner, we can further simplify the structure of \(\Gamma\) in Equation (15) to \(\Gamma=diag(\gamma_{1},...,\gamma_{n})\). Therefore, the error dynamics in Equation (16) change to  
\[\mathbb{E}=\mathbb{A}\mathbb{E}+\Gamma\mathbb{W}\cdot(L\otimes I_{m})\cdot \mathbb{E}, \tag{21}\]  
where \(L\) is the graph Laplacian of the communication topology \(\mathcal{G}\). Therefore, we can rewrite the adaptation law in this special case as follows:  
\[ \begin{split}\dot{\gamma}_{i}&=-(C_{i}e_{i})^{T} \sum_{j\in N_{i}}(C_{i}e_{j}-C_{i}e_{i})\\ &=-(C_{i}e_{i})^{T}\sum_{j\in N_{i}}C_{i}(\hat{x}_{j}-\hat{x}_{i} )\end{split}  \tag{22}\]  
**Remark 3**. : _By carefully examining the above analysis, we find that there is vagueness when observing the agreement evolution of our adaptive Kalman consensus filters. Thus, it is necessary to show that the convergence of individual a-KCF to a common value, which implies that each agent agrees with the others on their estimates. To this end, it is necessary to define a quantity to measure the disagreement level of the proposed a-KCF._  
**Lemma 2**. : _In a similar manner as [17], we define the measure of disagreement of \(n\) a-KCFs as follows:_  
\[\delta_{i}(t)=\hat{x}_{i}(t)-\mu(t),\quad i=1,...,n \tag{23}\]  
_where \(\mu(t)=\frac{1}{n}\sum_{j=1}^{n}\hat{x}_{i}(t)\) is the mean estimate of \(n\) a-KCFs. Therefore, \(\delta_{i}\) represents the deviation of each agent's estimate from the mean estimate.