# INVSID 1.0: An Inverse System Identification Toolbox for MATLAB
## 2 Creation of INVSID 1.0
### Inverse System Identification Toolbox Creation
The obtained model \(G_{\text{s}}\) can then be used for validating the goodness of the identified inverse model \(\hat{G}_{\text{inv}}\) in the frequency range of interest. The frequency response of the obtained model \(\hat{G}_{\text{inv}}\) is shown in Figure 5; in the specified frequency range from 10 Hz to 500 Hz, the magnitude is nearly a constant near 0 dB, and the phase is nearly a constant around 0 degrees. The values of magnitude and phase can indicate the effectiveness of the proposed inverse identification toolbox for stable systems to be inverted. In practice, unstable systems are also frequently encountered. So the second numerical example is about using the toolbox INVSID 1.0 to solve the system inversion problem of an unstable system. Figure 4: Bode plot of \(\hat{G}_{\text{inv}}\). Figure 5: Bode plot of \(G_{\text{s}}\). Consider a discrete-time, single-input single-output, linear, constant dynamical system \(G_{\rm d}^{*}\), of which the transfer function is described by

\[G_{\rm d}^{*}(z)=\frac{z}{z^{2}-5z+6} \tag{34}\]

with the sampling period \(T_{\rm s}=1\times 10^{-5}\) s.

The Bode plot of the system \(G_{\rm d}^{*}\) is displayed in Figure 6.

According to the transfer function (34), the following observations can be made:

(a) \(G_{\rm d}^{*}\) is unstable. (b) \(G_{\rm d}^{*}\) is proper. (c) \(G_{\rm d}^{*}\) is minimal-realized. (d) \(G_{\rm d}^{*}\) has one nonminimum-phase zero. The parameters shown in Table 2 are used as the inputs of the inverse identification toolbox. With the above inputs, the final output of the inverse identification toolbox is the identified inverse model which is the best model corresponding to the recommended singular value. The model order of the identified inverse model \(\hat{G}_{\rm inv}^{*}\) is recommended to be 4. The frequency response properties of the model \(\hat{G}_{\rm inv}^{*}\), with fourth order are demonstrated in Figure 7. \begin{table}
\begin{tabular}{l l} \hline \hline
**Parameter** & **Value in MATLAB** \\ \hline numerator & \([0,1,0]\) \\ denominator & \([1,-5,6]\) \\ \(T_{\rm s}\) & \(1\times 10^{-5}\) \\ \(f_{\rm b}\) & \(10\) \\ \(d\) & \(10\) \\ \(N\) & \(50\) \\ pc & \(1\times 10^{-3}\) \\ mc & \(1\times 10^{-3}\) \\ nx & \(2\):\(10\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Parameters for inverse identification. Figure 6: Bode plot of \(G_{\rm d}^{*}\). In addition, the inversion \(\hat{G}^{*}_{\text{inv}}\) is identified using the MATLAB function n4 sid with stability enforcement, so the identified model \(\hat{G}^{*}_{\text{inv}}\) is stable and causal. By connecting the model \(G^{*}_{\text{d}}\) and the model \(\hat{G}^{*}_{\text{inv}}\) in series using Equation (19), the model \(G^{*}_{\text{s}}\) can be obtained. The frequency response of the obtained model \(\hat{G}^{*}_{\text{inv}}\) is shown in Figure 8; in the specified frequency range from 10 Hz to 500 Hz, the magnitude is nearly a constant near 0 dB, and the phase is nearly a constant around 0 degrees. The values of magnitude and phase can indicate the effectiveness of the proposed inverse identification toolbox for unstable systems to be inverted. Figure 8: Bode plot of \(G^{*}_{\text{s}}\). ### Practical Hard Disk Drive System

Figure 9 shows a block diagram to illustrate the goal of the system inversion design, where \(r(k)\in\mathbb{R}\), \(u(k)\in\mathbb{R}\), and \(y(k)\in\mathbb{R}\) represent the discrete-time reference, the input, and the output signals, respectively. Note that \(F\) can be implemented as a block in the feedforward controller design. In Figure 9, the overall transfer function from the reference signal \(r(k)\) to the output signal \(y(k)\) is

\[\frac{Y(z)}{R(z)}=F(z)G(z)=\hat{G}_{\text{inv}}(z)G(z)=G_{\text{s}}(z), \tag{35}\]

where \(F(z)=\hat{G}_{\text{inv}}\) denotes the inversion of the system \(G(z)\). Equation (35) can reflect the accuracy of the inversion \(F(z)\). We take the hard disk drive system as an illustrative example [26; 27].