# Control for Ship Course-Keeping Using Optimized Support Vector Machines
## 4 Example Study
Moreover, the control inputs are reasonable and applicable from the point of view of operation. As a comparison, a conventional PD controller is designed as follows,  
\[\delta_{c}=k_{1}e+k_{2}\dot{e} \tag{50}\]  
where \(k_{1,2}\) are control gains, selected as \(k_{1}=5\), \(k_{2}=50\). Figure 4 presents the simulation results using the PD controller designed. Compared with the performance of the SVM based controller as shown in Figure 3, it can be seen that obvious oscillation happens to the command rudder angle for a PD controller, which implies a limitation for the PD controller from an operational point of view despite the simple structure of the PD controller. Further comparison is carried out by combining the SVM identification and inverse dynamic compensation that is commonly employed to obtain a feedback controller for a certain system (without uncertainties). By observing the inequality (24), the auxiliary controllers \(u_{1}\) and \(u_{2}\) can be designed as  
\[\left. \begin{array}{l}u_{1}=T\lambda\dot{e}-f(\psi,\dot{\psi})\dot{e}+e+ \frac{1}{4\mu_{1}^{2}}\zeta+r_{2}^{2}\zeta-2r_{2}^{2}\lambda e+\sum\limits_{i= 1}^{2}\alpha_{i}^{\prime}K(\mathbf{x}_{i},\mathbf{x})+\lambda_{1}T\zeta,(\lambda_{1}>0 )\\ u_{2}=K\zeta-\zeta+\sum\limits_{i=1}^{2}\beta_{i}^{\prime}K(\mathbf{x}_{i},\mathbf{x} )+\lambda_{2}T_{E}\xi,(\lambda_{2}>0)\end{array} \right\} \tag{51}\]  
Figure 3: Simulation results using an SVM-based controller. which indicates that only the modeling errors \(\Delta(\psi,\dot{\psi})\) and the derivative of desired rudder angle \(\delta_{d}\) in the inequality (20) are approximated by SVM, i.e.,  
\[\Delta(\psi,\dot{\psi})=\sum\limits_{i=1}^{l_{1}}\alpha_{i}K\left(\mathbf{x}_{i},\bm {x}\right)+\eta_{1} \tag{52}\]  
\[T_{E}\dot{\delta}_{d}=\sum\limits_{i=1}^{l_{2}}\beta_{i}K\left(\mathbf{x}_{i},\bm {x}\right)+\eta_{2} \tag{53}\]  
The terminal control input can be defined as  
\[ \begin{array}{ll}\delta_{c}&=(T\ddot{\psi}_{d}+f\dot{\psi}_{d}+T\lambda\dot{ e}-f(\psi,\dot{\psi})\dot{e}+e+\frac{1}{4\mu_{1}^{2}}\zeta+r_{2}^{2}\zeta-2r_{2}^{2} \lambda e+\sum\limits_{i=1}^{2}\alpha_{i}^{\prime}K\left(\mathbf{x}_{i},\mathbf{x} \right)+\lambda_{1}T\zeta)/K\\ &+K\zeta-\xi+\sum\limits_{i=1}^{2}\beta_{i}^{\prime}K\left(\mathbf{x}_{i},\mathbf{x} \right)+\lambda_{2}T_{E}\zeta\end{array}  \tag{54}\]  
Comparing controller (54) with (31), one can find that the controller with inverse dynamic compensation in combination with SVM identification (given by (54)) is more complicated than the controller in which the complicated nonlinear function are indentified by SVM (given by (31)). Figure 5 presents the simulation results using controller (54). The parameters are selected as \(\mu_{1}=0.25,r_{2}=1\). In comparison with the results shown in Figure 3, it can be seen that oscillation of the command rudder angle happens at the initial stage and at the time of instantaneous external disturbance despite rapid convergence. Further remarks can be made as follows: (_i_) no matter whether inverse dynamic compensation is incorporated, the stability and robustness of the control system can be guaranteed due to the use of Lyapunov theory and L2-gain design; (_ii_) although the response rate of the controller in the case of inverse dynamic compensation (as described by (54)) is better than the case without compensation (as described by (31)), a moderate helming as shown in Figure 3, which can be achieved  
Figure 4: Simulation results using PD controller. by using the controller (31), is preferable from the practical point of view. Moreover, as can be seen, the structure of the controller (31) is simpler than the controller (54), which makes sense in practice.