## 3 The Bias Compensation-Based Parameter and State Estimation Algorithm
### The Parameter Estimation Algorithm  
According to the identification model in Equation (15), define the cost function:  
\[J(\boldsymbol{\vartheta}):=\sum_{i=1}^{k}[y(i)-\boldsymbol{\phi}_{\text{s}}^{ \tau}(i)\boldsymbol{\vartheta}]^{2}\]  
Using the least squares search and minimizing \(J(\boldsymbol{\vartheta})\) give the least squares estimate \(\hat{\boldsymbol{\vartheta}}_{\text{LS}}(k)\) of the parameter vector \(\boldsymbol{\vartheta}\):  
\[\hat{\boldsymbol{\vartheta}}_{\text{LS}}(k) =\boldsymbol{P}(k)\sum_{i=1}^{k}\boldsymbol{\phi}_{\text{s}}(i)y (i), \tag{17}\] \[\boldsymbol{P}^{-1}(k) =\sum_{i=1}^{k}\boldsymbol{\phi}_{\text{s}}(i)\boldsymbol{\phi}_{ \text{s}}^{\tau}(i).\]  
Inserting (14) into (17) and using (13), we have:  
\[\hat{\boldsymbol{\vartheta}}_{\text{LS}}(k) =\boldsymbol{P}(k)\sum_{i=1}^{k}\boldsymbol{\phi}_{\text{s}}(i)[ \boldsymbol{\phi}_{\text{s}}^{\tau}(i)\boldsymbol{\vartheta}+\boldsymbol{ \phi}_{\text{n}}^{\tau}(i)\boldsymbol{\vartheta}+e(i)]\] \[=\boldsymbol{\vartheta}+\boldsymbol{P}(k)\sum_{i=1}^{k} \boldsymbol{\phi}_{\text{s}}(i)[\boldsymbol{\phi}_{\text{n}}^{\tau}(i) \boldsymbol{\vartheta}+e(i)]. \tag{18}\]  
Obviously, the least squares estimate \(\hat{\boldsymbol{\vartheta}}_{\text{LS}}(k)\) in Equation (18) is a biased estimate since \(e(k)\) is correlated noise. Equation (18) can be rewritten as:  
\[\boldsymbol{P}^{-1}(k)[\hat{\boldsymbol{\vartheta}}_{\text{LS}}(k)- \boldsymbol{\vartheta}]=\sum_{i=1}^{k}\boldsymbol{\phi}_{\text{s}}(i)[ \boldsymbol{\phi}_{\text{n}}^{\tau}(i)\boldsymbol{\vartheta}+e(i)].\]  
Dividing by \(k\) and taking limits on both sides give:  
\[\lim_{k\to\infty}\frac{1}{k}[\boldsymbol{P}^{-1}(k)(\hat{\boldsymbol{\vartheta }}_{\text{LS}}(k)-\boldsymbol{\vartheta})]=\left[\lim_{k\to\infty}\frac{1}{k} \sum_{i=1}^{k}\boldsymbol{\phi}_{\text{s}}(i)\boldsymbol{\phi}_{\text{n}}^{ \tau}(i)\right]\boldsymbol{\vartheta}+\lim_{k\to\infty}\frac{1}{k}\sum_{i=1}^{ k}\boldsymbol{\phi}_{\text{s}}(i)e(i). \tag{19}\]  
Note that \(e(k)\) in Equation (19) is the moving average noise, and \(v(k)\) is white noise with zero mean and variance \(\delta\) and is independent of the inputs. From Equation (3), we have:  
\[R(0) :=\text{E}[e^{2}(k)]=(1+e_{1}^{2}+e_{2}^{2}+\cdots+e_{n_{e}}^{2}) \delta=[1+\boldsymbol{\vartheta}_{\text{v}}^{\tau}\boldsymbol{\vartheta}_{ \text{v}}]\delta,\] \[R(i) :=\text{E}[e(k-i)e(k)]=(e_{i}+e_{i+1}e_{1}+\cdots+e_{n_{e}}e_{n_{e }-i})\delta\] \[=\boldsymbol{\vartheta}_{\text{v}}^{\tau}(i:n_{e})\left[ \begin{array} []{c}1\\ \boldsymbol{\vartheta}_{\text{v}}(1:n_{e}-i)\end{array} \right]\delta,\;i=1,2,\cdots,n_{e},\]  
where \(R(i)\) is the autocorrelation function of the noise \(e(k)\) and \(R(i)=0\) when \(i>n_{e}\). Define the autocorrelation function vectors \(\boldsymbol{r}\) and \(\boldsymbol{\zeta}\) and the autocorrelation function matrices \(\boldsymbol{R}\), \(\boldsymbol{\Lambda}\) and \(\boldsymbol{Q}\) as:  
\[\boldsymbol{r} :=[R(n),R(n-1),\cdots,R(1),0,0\cdots,0]^{\tau}\in\mathbb{R}^{2n}, \tag{20}\] \[\boldsymbol{\zeta} :=[R(n)/\delta,R(n-1)/\delta,\cdots,R(1)/\delta,0,0\cdots,0]^{ \tau}\in\mathbb{R}^{2n}, \tag{21}\]\[\mathbf{R} :=\text{diag}[\mathbf{\Lambda},\mathbf{0}]\in\mathbb{R}^{(2n)\times(2n)}, \tag{22}\] \[\mathbf{\Lambda} :=\left[ \begin{array}{cccc}R(0)&R(1)&\cdots&R(n-1)\\ R(1)&R(0)&\cdots&R(n-2)\\ \vdots&\vdots&\ddots&\vdots\\ R(n-1)&R(n-2)&\cdots&R(0)\end{array} \right]\in\mathbb{R}^{n\times n},\] (23) \[\mathbf{Q} :=\mathbf{R}/\delta. \tag{24}\]  
In fact, \(\mathbf{\Lambda}\) is a Toeplitz matrix consisting of \(n\) autocorrelation functions.