## 5 Neural Control Design and Stability Analysis
The diagram in Figure 2 describes the general operation of the proposed algorithm applied to the AUV system dynamic Equations (20)-(23) for trajectory tracking. The closed-loop system structure is composed of the AUV dynamic model to develop a parallel identifier based on online adjustment of the DNN weights and the estimation law of parameter \(b\), a reference system that generates the desired trajectory and a controller to calculate the input signal for both the AUV system and the identifier. The DNCS scheme performs a simultaneous identification and control of the unknown perturbed AUV system, implementing an online training process that makes use of input-output data of its evolution over time. The learning laws that feed the proposed DNCS scheme comprise a set of differential equations for which the solutions are the DNN weight matrices and the parametric estimation of the constant input gain involved in the structure proposed in Equation (25). The DNN weight matrices \(\mathbf{W}(t)\) are updated according to the evolution over time of the identification error. This error is defined as the difference between the system and the identifier states. Additionally, the difference between the nominal and the actual values of these weight matrices is added, as a correction term (denoted by \(\mathbf{\hat{W}}(t)\)), in the adjustment of the learning law. On the other hand, the estimate \(\hat{b}(t)\) is also calculated by considering the identification error evolution to perform a parameter identification process. Thus, the DNCS-based identifier copies the system behavior by conducting an online adjustment of the weight matrices and the parametric estimate, causing the identification error to attain reduced values. The information provided by the identifier is used to design a tracking control for each AUV subsystem. This control input is comprised of the compensation of unknown dynamics of the plant provided by the DNCS and a standard feedback control. **Note for practitioners**: the DNCS identification and control scheme carry out an online training process by using only the input-output information of the unknown perturbed AUV system. Regarding the DNCS algorithm tuning procedure, a set of parameters are adjusted by trial and error to perform effective identification and control of the unknown dynamics. The gain \(\gamma_{1}\) determines the speed of learning of each DNN. This value is adjusted by taking into account the speed of the dynamic changes of the unknown AUV dynamics. That is, it takes greater values if the dynamic response to be identified is characterized by several signals of different frequencies (for example, hydrodynamic damping combined with abrupt currents or waves affecting the AUV system). Additionally, the nominal values of the weight matrices \(\mathbf{W_{0}}\) in the DNN structure can be adjusted. However, one may use their corresponding upper values, which may be supposed to be known, or they can be obtained by an offline training considering some AUV experimental data. The parameters \(a_{1}\) and \(a_{2}\) that correspond to the linear part of the DNN structure only must fulfill being negative real values, and generally, once they are selected, they are considered as fixed values. Another free design parameter is the adaptive gain \(\gamma_{2}\), which is related to the rate of convergence of the parameter identification. Numerical simulations showed that the rate of parameter convergence increases with increasing adaptive gain. Regarding the sigmoidal activation function parameters \(\mathbf{b}_{i},\mathbf{c}_{i}\), and \(\mathbf{d}_{i}\), they can be selected by trial and error to enhance the identifier response; however, for simplicity in the simulation experiments, we considered some baseline values suggested by related works [39; 54] that implements the kind of dynamic neural network used in the proposed DNCS. Figure 2: Block diagram of the closed-loop system.