## 3 The Bias Compensation-Based Parameter and State Estimation Algorithm
### The State Estimation Algorithm  
When the system parameter estimation and the noise estimation \(\hat{e}(k)\) are obtained from the BC-PE algorithm, we can estimate the system state \(\mathbf{x}(t)\) using Equation (11). Post-multiplying Equation (4) by \(\mathbf{h}\) and letting the elements of each row be equal, we have:  
\[\mathbf{f}\mathbf{G}^{i-1}\mathbf{h}=h_{i},\;i=1,2,\cdots,n.\]Then, the parameter matrix \(\mathbf{M}\) can be expressed as:  
\[\mathbf{M}=\left[ \begin{array}{cccccc}0&0&\cdots&0&0\\ h_{1}&0&\cdots&0&0\\ h_{2}&h_{1}&\ddots&\vdots&\vdots\\ \vdots&\vdots&\ddots&0&0\\ h_{n-1}&h_{n-2}&\cdots&h_{1}&0\end{array} \right].\]  
Post-multiplying Equation (4) by \(\mathbf{G}\) and letting the elements of \(n\)-th row be equal, we have:  
\[\mathbf{f}\mathbf{G}^{n}=[g_{1},g_{2},\cdots,g_{n}].\]  
According to the definitions of \(\mathbf{\vartheta}_{\rm g}\) and \(\mathbf{\vartheta}_{\rm h}\), we have:  
\[\mathbf{\vartheta}_{\rm g} =[\mathbf{f}\mathbf{G}^{n}]^{\rm T}=[g_{1},g_{2},\cdots,g_{n}]^{\rm T},\] \[\mathbf{\vartheta}_{\rm h} =[-f\mathbf{G}^{n}\mathbf{M}+[\mathbf{f}\mathbf{G}^{n-1}\mathbf{h},\mathbf{f}\mathbf{G}^{n-2 }\mathbf{h},\cdots,\mathbf{f}\mathbf{h}]]^{\rm T}\] \[=\left[ \begin{array}{cccc}-h_{1}g_{2}-h_{2}g_{3}-\cdots-h_{n-1} g_{n}+h_{n}\\ -h_{1}g_{3}-h_{2}g_{4}-\cdots-h_{n-2}g_{n}+h_{n-1}\\ \vdots\\ -h_{1}g_{n}+h_{2}\\ h_{1}\end{array} \right]=\left[ \begin{array}{cccc}-g_{2}&-g_{3}&\cdots&-g_{n }&1\\ -g_{3}&-g_{4}&\cdots&1&0\\ \vdots&\vdots&&\vdots&\vdots\\ -g_{n}&1&\cdots&0&0\\ 1&0&\cdots&0&0\end{array} \right]\left[ \begin{array}{c}h_{1}\\ h_{2}\\ \vdots\\ h_{n-1}\\ h_{n}\end{array} \right].\]  
Once the estimate of the parameter vector \(\mathbf{\vartheta}\) is computed by the BC-PE algorithm in Equations (26)-(40), we can extract the estimates \(\mathbf{\hat{\vartheta}}_{\rm g}(k)\) and \(\mathbf{\hat{\vartheta}}_{\rm h}(k)\) of the parameter vectors \(\mathbf{\vartheta}_{\rm g}\) and \(\mathbf{\hat{\vartheta}}_{\rm h}\). Then, the estimates \(\hat{g}_{i}(k)\) and \(\hat{h}_{i}(k)\) can be computed by:  
\[\mathbf{\hat{\vartheta}}_{\rm g}(k) =[\hat{g}_{1}(k),\hat{g}_{2}(k),\cdots,\hat{g}_{n}(k)]^{\rm T}, \tag{41}\] \[\left[ \begin{array}{c}\hat{h}_{1}(k)\\ \hat{h}_{2}(k)\\ \vdots\\ \hat{h}_{n-1}(k)\\ \hat{h}_{n}(k)\end{array} \right] =\left[ \begin{array}{cccc}-\hat{g}_{2}(k)&-\hat{g}_{3}(k)& \cdots&-\hat{g}_{n}(k)&1\\ -\hat{g}_{3}(k)&-\hat{g}_{4}(k)&\cdots&1&0\\ \vdots&\vdots&&\vdots&\vdots\\ -\hat{g}_{n}(k)&1&\cdots&0&0\\ 1&0&\cdots&0&0\end{array} \right]^{-1}\] \[\mathbf{\hat{\vartheta}}_{\rm h}(k). \tag{42}\]  
From Equation (11), we have:  
\[\mathbf{x}(k-n)=\mathbf{\phi}_{\rm y}(k)-\mathbf{M}\mathbf{\phi}_{\rm u}(k)-\mathbf{\phi}_{\rm e}(k).\]  
Replacing \(\mathbf{M}\) and \(\mathbf{\phi}_{\rm e}(k)\) with their corresponding estimates \(\mathbf{\hat{M}}(k)\) and \(\mathbf{\hat{\phi}}_{\rm e}(k)\), we have:  
\[\mathbf{\hat{x}}(k-n) =\mathbf{\phi}_{\rm y}(k)-\mathbf{\hat{M}}(k)\mathbf{\phi}_{\rm u}(k)-\mathbf{\hat {\phi}}_{\rm e}(k), \tag{43}\] \[\mathbf{\phi}_{\rm y}(k) =[y(k-n),y(k-n+1),\cdots,y(k-1)]^{\rm T},\] (44) \[\mathbf{\phi}_{\rm u}(k) =[u(k-n),u(k-n+1),\cdots,u(k-1)]^{\rm T},\] (45) \[\mathbf{\hat{\phi}}_{\rm e}(k) =[\varrho(k-n),\varrho(k-n+1),\cdots,\varrho(k-1)]^{\rm T},\] (46) \[\mathbf{\hat{M}}(k) =\left[ \begin{array}{cccc}0&0&\cdots&0&0\\ \hat{h}_{1}(k)&0&\cdots&0&0\\ \hat{h}_{2}(k)&\hat{h}_{1}(k)&\ddots&\vdots&\vdots\\ \vdots&\vdots&\ddots&0&0\\ \hat{h}_{n-1}(k)&\hat{h}_{n-2}(k)&\cdots&\hat{h}_{1}(k)&0\end{array} \right]. \tag{47}\]Equations (41)-(47) form the state estimation algorithm for the state-space system in Equation (1). Let \(\mathbf{\theta}:=[g^{\tau},h^{\tau},\mathbf{\theta}_{\mathrm{v}}^{\dagger}]^{\tau}\in \mathbb{R}^{2n+n_{\varepsilon}},g:=[g_{1},g_{2},\cdots,g_{n}]\in\mathbb{R}^{n}\). By interactively implementing the parameter estimation algorithm in Equations (26)-(40) and the state estimation algorithm in Equations (41)-(47), the estimation of the system parameter vector \(\mathbf{\theta}\) and the state \(\mathbf{x}(k)\) can be obtained.