# MRAS Using Lyapunov Theory with Sliding Modes for a Fixed-Wing MAV
## 3 Adaptive Controller Design and Stability Proof
\]  
\[\underline{\eta}_{m}= \begin{pmatrix}\eta_{m}\\ \dot{\eta}_{m}\end{pmatrix} ,\quad B_{\kappa_{m}}= \begin{pmatrix}0\\ \omega_{n}^{2}\end{pmatrix} ,\quad\kappa_{d}:=\theta_{d},\psi_{d},\phi_{d}\]  
The error dynamic is defined by:  
\[\dot{\underline{e}}_{\kappa_{m}}=A_{\kappa_{m}}\underline{e}_{\kappa_{m}}+(A _{\kappa_{m}}-A_{\kappa})\underline{\kappa}+(B_{\kappa_{m}}-B_{\kappa})\kappa _{d} \tag{15}\]  
with \(\underline{e}_{\kappa_{m}}=[e_{\kappa_{m}}\underline{e}_{\kappa_{m}}]^{T}\) and \(\underline{\kappa}=[\kappa\dot{\kappa}]^{T}\). The equilibrium point \(e_{\kappa_{m}}=0\) is asymptotically stable if the adaptive law to design the adjustment mechanism is chosen as:  
\[\dot{A}_{\kappa} = \gamma_{\kappa}P_{\kappa}\underline{e}_{\theta_{m}}\underline{ \kappa}^{T} \tag{16}\] \[\dot{B}_{\kappa_{m}} = \gamma_{\kappa}P_{\eta}\underline{e}_{\theta_{m}}\kappa_{d} \tag{17}\]  
where \(P_{\kappa}\) is a positive definite matrix; which is a solution of the Lyapunov equation \(A_{\kappa m}^{T}P_{\kappa}+P_{\kappa}A_{\kappa_{m}}=-Q_{\kappa}<0\). Finally, working the corresponding operations from the Equations (16) and (17), an equality that corresponds to each adaptive gain \(\dot{\underline{k}}_{p\kappa a_{1}}\) and \(\dot{\underline{k}}_{d\kappa a_{1}}\) is obtained. The adaptation laws for the adaptive controller by the Lyapunov theory are given by:  
\[\dot{\underline{k}}_{p\kappa a_{1}} = -\gamma_{1\kappa a_{1}}(p_{21}^{x}e_{\kappa_{m}}+p_{22}^{x}e_{ \kappa_{m}})(\kappa-\kappa_{d}) \tag{18}\] \[\dot{\underline{k}}_{d\kappa a_{1}} = -\gamma_{2\kappa a_{1}}(p_{21}^{x}e_{\kappa_{m}}+p_{22}^{x}e_{ \kappa_{m}})\dot{\kappa} \tag{19}\]  
where \(\gamma_{1\kappa a_{1}}\) and \(\gamma_{2\kappa a_{1}}\) are the adaptation gains and these are definite negatives. To develop the robust adjustment mechanism based on the Lyapunov theory and the sliding mode theory, the adjustment mechanism equations are defined:  
\[\dot{A}_{\kappa} = \gamma_{\kappa}P_{\kappa}\underline{e}_{\theta_{m}}\kappa^{T}+v _{\kappa} \tag{20}\] \[\dot{B}_{\kappa_{m}} = \gamma_{\kappa}P_{\kappa}\underline{e}_{\theta_{m}}\kappa_{d}+v _{\kappa} \tag{21}\]  
with \(v_{\kappa}:=\sigma_{\kappa}\dot{\sigma}_{\kappa}\), and \(\sigma_{\kappa}=\dot{\kappa}+k_{1\kappa}\cdot e_{\kappa}\) is the sliding manifold (\(k_{1\kappa}>0\)), and \(\epsilon_{\kappa}=\kappa_{d}-\kappa\). Analyzing \(v_{\kappa}\) with the Lyapunov theory [30], a positive definite quadratic function \(V_{\kappa}=\frac{1}{2}\sigma_{\kappa}^{2}\) is defined, resulting in a negative definite derivative \(\dot{V}_{\kappa}=-k_{2\kappa}\sigma_{\kappa}^{2}-\sigma_{\kappa}p_{1\kappa} \operatorname{sign}(\sigma_{\kappa})<0\Longleftrightarrow k_{2\kappa},\beta _{\kappa}>0\wedge\sigma_{\kappa}\to 0\). Thus, the equilibrium point \(e_{\kappa_{m}}=0\) presents global stability for the design of the adjustment mechanism based on the Lyapunov theory with first-order sliding mode [31; 32; 33]. Then, from Equations (20) and (21), the adaptation mechanism equations by the Lyapunov theory and the first-order sliding mode theory (L-SM) are given by:  
\[\dot{\underline{k}}_{p\kappa a_{2}} = -\gamma_{1\kappa a_{2}}(p_{21}^{x}e_{\kappa_{m}}+p_{22}^{x} \dot{e}_{\kappa_{m}})(\kappa-\kappa_{d})-k_{2\kappa}\sigma_{\kappa}-\beta_{1 \kappa}\operatorname{sign}(\sigma_{\kappa}) \tag{22}\] \[\dot{\underline{k}}_{d\kappa a_{2}} = -\gamma_{2\kappa a_{2}}(p_{21}^{x}e_{\kappa_{m}}+p_{22}^{x} \dot{e}_{\kappa_{m}})\dot{\kappa}-k_{2\kappa}\sigma_{\kappa}-\beta_{1\kappa} \operatorname{sign}(\sigma_{\kappa}) \tag{23}\]  
with \(\gamma_{1\kappa a_{2}},\gamma_{\kappa a_{2}}<0\).