# Control for Ship Course-Keeping Using Optimized Support Vector Machines
## 3 Controller Design and Stability Analysis
### Controller Design
Different from the way used to deal with the disturbance \(w\), the modeling error \(\Delta(\psi,\dot{\psi})\) will be identified and compensated instead of being suppressed by using L2-gain design. This is because although both modeling error and disturbance are uncertainties, the modeling error is usually a continuous signal while the disturbance \(w\) might be instantaneous. In this paper SVM is proposed to approximate such a continuous uncertainty. Besides, the term \(T_{E}\dot{\delta}_{d}\) in (24) is also dealt with by SVM. As seen from (24), to obtain \(u_{2}\), it is necessary to calculate the derivative of \(\dot{\delta}_{d}\). According to the Equation (11), one has  
\[\dot{\delta}_{d}=\frac{1}{K}(T\vec{\psi}_{d}+f(\psi,\dot{\psi})\ddot{\psi}_{d} +2\alpha\dot{\psi}\ddot{\psi}\dot{\psi}_{d}+\dot{u}_{1}) \tag{25}\]  
The main difficulty is to calculate the derivative of \(u_{1}\). Therefore, SVM is used to identify this complicated nonlinear function. One can define the two nonlinear functions in (24) and their SVM approximations as  
\[f_{1}=T\lambda\dot{e}-f(\psi,\dot{\psi})\dot{e}+\Delta(\psi,\dot{\psi})+e+ \frac{1}{4\mu_{1}^{2}}\zeta+r_{2}^{2}\zeta-2r_{2}^{2}\lambda e=\sum_{i=1}^{l_{ 1}}\alpha_{i}K\left(\mathbf{x}_{i},\mathbf{x}\right)+\eta_{1} \tag{26}\]  
\[f_{2}=T_{E}\dot{\delta}_{d}+K\zeta-\xi=\sum_{j=1}^{l_{2}}\beta_{j}K\left(\mathbf{x} _{j},\mathbf{x}\right)+\eta_{2} \tag{27}\]where \(\eta_{i}(i=1,2)\) is the approximation error and contains the constant \(b\) that is defined in (6). Moreover, it is assumed that \(|\eta_{1}|\leq\eta_{1N},|\eta_{2}|\leq\eta_{2N}(\eta_{1N}>0,\eta_{2N}>0)\). \(\alpha_{i}\) and \(\beta_{j}\) are Lagrangian factors. If the SVM approximates the nonlinear functions \(f_{1}\) and \(f_{2}\) very well, the prediction errors \(\eta_{1,2}\) should be small enough. In that case, the Lagrangian factors, \(\alpha_{i}\) and \(\beta_{j}\), can be called \"ideal\" Lagrangian factors. However, these \"ideal\" factors are actually unable to be obtained in controller design because \(\Delta(\psi,\dot{\psi})\) and \(\dot{\delta}_{d}\) in (26) and (27) are unknown uncertainties. Suppose \(\alpha_{i}^{\prime}\) and \(\beta_{j}^{\prime}\) are the updated approximations of their \"ideal\" values with high accuracy, the two nonlinear functions \(f_{1}\) and \(f_{2}\) can be approximated by  
\[f_{1} \approx\sum\limits_{i=1}^{l_{1}}\alpha_{i}^{\prime}K\left(\mathbf{x}_{i}, \mathbf{x}\right) \tag{28}\] \[f_{2} \approx\sum\limits_{j=1}^{l_{2}}\beta_{j}^{\prime}K(\mathbf{x}_{j}, \mathbf{x}) \tag{29}\]  
Thus, the two auxiliary controllers \(u_{1}\) and \(u_{2}\) in (24) can be designed as  
\[\left. \begin{array}{l}u_{1}=\sum\limits_{i=1}^{l_{1}}\alpha_{i}^{\prime}K \left(\mathbf{x}_{i},\mathbf{x}\right)+\lambda_{1}T\zeta\\ u_{2}=\sum\limits_{j=1}^{l_{2}}\beta_{j}^{\prime}K(\mathbf{x}_{j},\mathbf{x})+\lambda_ {2}T_{E}\xi\end{array} \right\} \tag{30}\]  
where \(\lambda_{1}\) and \(\lambda_{2}\) are positive control gains. Combining the auxiliary controllers with (11) and (16), the command rudder angle to the cascaded System (5) can be expressed as  
\[\delta_{c}=\frac{1}{K}(T\ddot{\psi}_{d}+f\dot{\psi}_{d}+\sum\limits_{i=1}^{l_{ 1}}\alpha_{i}^{\prime}K\left(\mathbf{x}_{i},\mathbf{x}\right)+\lambda_{1}T\zeta)+\sum \limits_{j=1}^{l_{2}}\beta_{j}^{\prime}K(\mathbf{x}_{j},\mathbf{x})+\lambda_{2}T_{E}\xi \tag{31}\]  
Figure 1 shows the control framework.