# A Novel Adaptive Gain of Optimal Sliding Mode Controller for Linear Time-Varying Systems
## 2 Design of Optimal Control Law
Then, the optimal control law is obtained as follows:  
\[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]0  
where the gain matrix \(Q_{L\xi}(t)\) is found from \(\frac{dq_{L\xi}}{dt}=-\frac{\partial H_{M}}{\partial x_{L\xi}}\), and the Hamilton function \(H_{M}(x_{L\xi},u_{L\xi},q_{L\xi},t)=\frac{1}{2}\Big{(}u_{L\xi}^{T}M_{L\xi}(t)u_ {L\xi}+x_{L\xi}^{T}N_{L\xi}(t)x_{L\xi}\Big{)}+q_{L\xi}^{T}\dot{x}_{L\xi}(t)\) yields the following:  
\[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]1 \[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]2  
It is noted that the terminal condition \(Q_{L\xi}(t)=0\), and the optimal control system is defined as:  
\[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]3  
Then, the new gain matrix \(\gamma Q_{L\xi}(t)x_{L\xi}(t)\) can be rewritten as \(Q_{\Delta L}=\gamma Q_{L\xi}(t)\big{|}x_{L\xi}(t)\big{|}\), and hence, the derivative of the new modified gain matrix is derived as follows:\[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]4 \[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]5 \[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]6 \[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]7 \[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]8  
Now, Equation (6) is re-expressed as:  
\[J=\sum_{i=1}^{n}\frac{\Xi_{i\xi i}\big{|}x_{L\xi i}(T)\big{|}}{\gamma}+\frac{1 }{2}\int\limits_{t_{0}}^{T}\Bigl{(}u_{L\xi}^{T}(s)M_{L\xi}(s)u_{L\xi}(s)+x_{L \xi}^{T}(s)N_{L\xi}(s)x_{L\xi}(s)\Bigr{)}ds \tag{2}\]9  
The gain matrix function \(Q_{\Delta L}(t)\) given in Equation (9) is not sufficient to control the system because the negative sign in the right part will decrease the required energy for control the system. Hence, the maximum boundary based on elements of the right part is suggested as follows:  
\[u_{L\xi}^{*}(t)=-M_{L\xi}^{-1}(t){H_{L\xi}}^{T}(t)q_{L\xi}(t) \tag{3}\]0  
The above equation can be treated as maximum boundary of the gain matrix function of the proposed optimal control law. It is remarked that Equation (11) is the same as Equation (7). The appearance of \(\gamma\) in the proposed method is used to adjust the energy of the main input control \(u\) and then also adjust the energy in the gain matrix function. This modification will optimize the calculation progress and improve performance of the system. Normally, the value \(\gamma\) is chosen as \(\gamma\geq 1\). From Equation (11), another new equation of the gain matrix function can be found as follows:  
\[u_{L\xi}^{*}(t)=-M_{L\xi}^{-1}(t){H_{L\xi}}^{T}(t)q_{L\xi}(t) \tag{3}\]1  
**Remark 1**. : _The difference between Equations (11) and (12) will be shown in the simulation section.