# Two-Phase Non-Singular Terminal Sliding Mode Control of Nonlinear Systems
## 5 Numerical Simulations  
In this simulation study, the single inverted pendulum (SIP) system is considered. The dynamic equation of the SIP is formulated in the following. \[\left\{ \begin{array}{l}\dot{x}_{1}=x_{2}\\ \dot{x}_{2}=\frac{g\sin(x_{1})-mlx_{2}^{2}\cos(x_{1})\sin(x_{1})/(m_{c}+m)}{l(4 /3-m\cos^{2}(x_{1})/(m_{c}+m))}\\ +\frac{\cos(x_{1})/(m_{c}+m)}{l(4/3-m\cos^{2}(x_{1})/(m_{c}+m))}u+d\end{array} \right. \tag{27}\]  
where \(f=\frac{g\sin(x_{1})-mlx_{2}^{2}\cos(x_{1})\sin(x_{1})/(m_{c}+m)}{l(4/3-m\cos^ {2}(x_{1})/(m_{c}+m))}\), \(g=\frac{\cos(x_{1})/(m_{c}+m)}{l(4/3-m\cos^{2}(x_{1})/(m_{c}+m))}\) and \(x_{1}\) and \(x_{2}\) denote the angle and speed, \(d\) represents the disturbance, and \(\tilde{g}=9.8\) is the gravitational acceleration, \(m_{c}=1\) kg is the mass of the cart, and \(m=0.1\) kg is the mass of the pendulum, and \(l=0.5\) m is the length to pendulum center of mass. Part i. The effectiveness of the presented control scheme  
We define \(e_{1}(t)=x_{1}(t)-x_{d}(t)\) and \(e_{2}(t)=x_{2}(t)-\dot{x}_{d}(t)\). The control objective is to design a two-phase non-singular TSM controller such that the pendulum system tracks the given reference trajectory \(x_{d}(t)\) within finite time. On the basis of (20), the controller for the pendulum is constructed as  
\[u = -\frac{1}{g}\bigg{(}f+\gamma\text{sign}(s)-\ddot{x}_{d}+k_{1}\alpha_ {1}\text{sat}(e_{1}^{\alpha_{1}-1}e_{2},\zeta)+ \tag{28}\] \[((\frac{k_{1}}{2}+\frac{k_{2}}{2})+(\frac{k_{2}}{2}-\frac{k_{1}} {2})\text{sign}(|e_{1}|-e_{1t}))\times\] \[(\frac{3-\alpha_{1}}{2}+\frac{1-\alpha_{1}}{2}\text{sign}(|e_{1}| -e_{1t}))\times\] \[e_{1}^{\frac{1-\alpha_{1}}{2}+\frac{1-\alpha_{1}}{2}\text{sign}(| e_{1}|-e_{1t})}e_{2}+\] \[o_{1}s^{\alpha_{2}}+((\frac{o_{1}}{2}+\frac{o_{2}}{2})+(\frac{ o_{2}}{2}-\frac{o_{1}}{2})\text{sign}(|s|-s_{t}))\times\] \[s^{\frac{3-\alpha_{2}}{2}+\frac{1-\alpha_{2}}{2}\text{sign}(|s|- s_{t})}\bigg{)}\]  
where the sliding mode surface \(s\) is chosen as  
\[s=\left\{ \begin{array}{ll}e_{2}+k_{1}e_{1}^{\alpha_{1}}+k_{2}e_{1}^{2-\alpha _{1}},&\begin{array}{ll}|e_{1}|\geq e_{1t}\\ e_{1}|<e_{1t}\end{array}\end{array} \right. \tag{29}\]  
and the design parameters are: \(\alpha_{1}=13/15,\alpha_{2}=5/9,k_{1}=2,k_{2}=1,o_{1}=2,o_{2}=1\) and \(\gamma=2,\xi=2,e_{1t}=1.1,s_{t}=1.1\). The desired trajectory is given as \(x_{d}=\sin(0.5\pi t)\), and the disturbance is set as \(d=\sin(10x_{1})+\cos(x_{2})\). The initial state is chosen as \(x_{1}(0)=1.2\), \(x_{2}(0)=0.1\). The simulation results are shown in Figures 1-4. Figure 1 depicts the control input, where the chattering phenomenon exists due to the sign function \(\text{sign}(\cdot)\). Figure 2 shows the sliding mode \(s\), where the sliding mode surface converges to zero as \(t\) increases indicating the effectiveness of the control scheme. The system state \(x_{1}\) and the reference signal \(x_{d}\) are described in Figure 3 showing the tracking performance. Figure 1: The Control input \(u\). Part ii. The comparison with the existing results  
Figure 4: The Comparison of tracking error \(e_{1}\). Figure 3: The Tracking performance \(x_{1}\) and \(x_{d}\). Figure 2: The Sliding surface \(s\). The analysis of the settling time for the sliding mode control scheme is the main characteristic for scholars. In this part, we are going to consider the difference between the existing results and those obtained from the analysis of the settling time.