# INVSID 1.0: An Inverse System Identification Toolbox for MATLAB
## 2 Creation of INVSID 1.0
### Inverse Identification Approach
Based on the state-space model representation (11) for the augmented models \(G_{\mathrm{a},m}\), \(m=1,2,\ldots,N\), we can totally build \(N\) full-order observers corresponding to the augmented models \(G_{\mathrm{a},m}\), \(m=1,2,\ldots,N\), and we denote the \(m\)-th observer for the \(m\)-th augmented model \(G_{\mathrm{a},m}\) as \(E_{\mathrm{a},m}\), which can be described by  
\[\mathbf{\hat{x}}_{\mathrm{a},m}(k+1)=(\mathbf{A}_{\mathrm{a},m}-\mathbf{L}_{\mathrm{a},m} \mathbf{C}_{\mathrm{a},m})\mathbf{\hat{x}}_{\mathrm{a},m}(k)+\mathbf{L}_{\mathrm{a},m}y_{m }(k), \tag{15}\]  
where \(\mathbf{L}_{\mathrm{a},m}\) denotes the observer gain, and \(\mathbf{\hat{x}}_{\mathrm{a},m}(k)\) denotes the reconstructed value of \(\mathbf{x}_{\mathrm{a},m}(k)\) using the observer. With the reconstructed value \(\hat{\mathbf{x}}_{\mathrm{a},m}(k)\), we can obtain the reconstructed value of \(u_{m}(k)\), which can be calculated by the following equation:  
\[\hat{u}_{m}(k)=\mathbf{C}_{\mathrm{r},m}\hat{\mathbf{x}}_{\mathrm{a},m}(k), \tag{16}\]  
where  
\[\mathbf{C}_{\mathrm{r},m}=\big{(}0\times\mathbf{C}_{\mathrm{d}}\quad\mathbf{C}_{m}\big{)}. \tag{17}\]  
By combining (15) with (16), we can obtain a state-space model  
\[ \begin{cases}\hat{\mathbf{x}}_{\mathrm{a},m}(k+1)=(\mathbf{A}_{\mathrm{a},m}-\mathbf{L}_{ \mathrm{a},m}\mathbf{C}_{\mathrm{a},m})\hat{\mathbf{x}}_{\mathrm{a},m}(k)+\mathbf{L}_{ \mathrm{a},m}y_{m}(k),\\ \hat{u}_{m}(k)=\mathbf{C}_{\mathrm{r},m}\hat{\mathbf{x}}_{\mathrm{a},m}(k),\end{cases}  \tag{18}\]  
which can be regarded as a reconstructor of the input \(u_{m}(k)\) of the model (10). Let the model (18) be denoted as \(G_{\mathrm{inv},m}\), and the value of the frequency response function of the model \(G_{\mathrm{inv},m}\) at the frequency \(f_{m}\) can then be represented as \(G_{\mathrm{inv},m}(e^{-i\Omega_{m}T_{\mathrm{s}}})\) where \(\Omega_{m}=2\pi f_{m}\). Let the inverse model of the model \(G_{\mathrm{d}}\) be denoted as \(G_{\mathrm{inv}}\), and with the frequency response function values \(G_{\mathrm{inv},m}(e^{-i\Omega_{m}T_{\mathrm{s}}})\), \(m=1,2,\ldots,N\), the inverse model \(G_{\mathrm{inv}}\) in state-space representation can be identified by using the subspace-based system identification method in the frequency domain [23]. After system identification, the identified inverse model is denoted as \(\hat{G}_{\mathrm{inv}}\). The effective frequency range of the inverse model \(G_{\mathrm{inv}}\) can be specified by selecting the range of the frequencies of the signals \(u_{m}(k)\), \(m=1,2,\ldots,N\), in the set \(S\). Connect the models \(G_{\mathrm{d}}\) and \(\hat{G}_{\mathrm{inv}}\) in series, and the resulting model can be represented as  
\[G_{\mathrm{s}}=\hat{G}_{\mathrm{inv}}G_{\mathrm{d}} \tag{19}\]  
of which the frequency response function is written as  
\[G_{\mathrm{s}}(e^{-i\Omega T_{\mathrm{s}}})=|G_{\mathrm{s}}(e^{-i\Omega T_{ \mathrm{s}}})|e^{j\angle G_{\mathrm{s}}(e^{-i\Omega T_{\mathrm{s}}})}, \tag{20}\]  
where \(\Omega=2\pi f\) with \(f\) the ordinary frequency in Hz, so if the identified inverse model \(\hat{G}_{\mathrm{inv}}\) is perfect, the frequency response of the model \(G_{\mathrm{s}}\) should satisfy:  
1. \(|G_{\mathrm{s}}(e^{-i\Omega T_{\mathrm{s}}})|=1\). 2. \(\angle G_{\mathrm{s}}(e^{-i\Omega T_{\mathrm{s}}})\in\{\theta\mid\theta=2k\pi\) with \(k=0,1,2,\ldots\}\). By observing whether the frequency response function of the model \(G_{\mathrm{s}}\) within the frequency range specified by inverse system identification satisfies the above conditions (a) and (b) and to what extent it satisfies them, the goodness of the identified inverse model \(\hat{G}_{\mathrm{inv}}\) can be validated.