## 4 Numerical Simulation  
The UAV system is taken as the research object. In Reference [28], based on the detailed modeling of UAV attitude, the classic PI control algorithm is used to control the UAV longitudinal flight attitude. It is proved that the PI control algorithm can make the system track the desired signal better. On the basis of this model, the problem of the sensor fault estimation in UAV system is studied. The attitude model of the UAV is shown in Figure 1.  
According to References [29; 30; 31], the UAV model can be linearized and the system model can be described by Equation (3). The system state is  
\[\mathbf{x}(t)=\left[ \begin{array}{cccc}x_{1}&x_{2}&x_{3}&x_{4}\end{array}  \right]^{\mathsf{T}},\]  
where \(x_{1},x_{2},x_{3},x_{4}\) are bank angle, roll rate, yaw rate and sideslip angle, respectively. Its control variable is  
Figure 1: UAV attitude diagram. where \(\delta_{r},\delta_{a}\) are rudder deflection and aileron deflection, respectively. The matrices \(\mathbf{A},\mathbf{B},\mathbf{C},\mathbf{F}_{\alpha},\mathbf{F}_{\mathrm{s}}\) of the linear continuous time system Equation (3) are  
\[\mathbf{A}=\left[ \begin{array}{ccc}-0.210&0.034&-0.001&-0.990\\ 0.000&0.000&1.000&0.000\\ -5.555&0.000&-1.890&0.390\\ 2.430&0.000&-0.034&-2.980\end{array} \right],\]  
\[\mathbf{B}=\left[ \begin{array}{ccc}0.03&0.00\\ 0.00&0.00\\ 0.36&-1.60\\ -0.95&-0.03\end{array} \right],\mathbf{C}=\left[ \begin{array}{ccc}0&1&0&0\\ 0&0&1&0\\ 0&0&0&1\end{array} \right],\]  
\[\mathbf{F}_{\mathrm{z}}=\left[ \begin{array}{ccc}1&0&0&0\end{array} \right]^{ \mathrm{T}},\mathbf{F}_{\mathrm{s}}=\left[ \begin{array}{ccc}0&0&0.2\end{array}  \right]^{\mathrm{T}}.\]  
Reference [32] shows that, there are two typical failure modes of UAV sensor mechanism:  
1. Step fault. There is a fixed error between the measured output of the sensor and the actual value of the measured parameter. It is mainly caused by bias current or bias voltage. 2. Periodic fault. The error caused by the superposition of the measured output value of the sensor with the signal of a certain frequency. It mainly includes power signal interference and so on. These two kinds of faults are the main factors that cause UAV to deviate from the course, so we carried out simulation experiments on these two kinds of faults. The UAV system works normally in 0 s\(\sim\)25 s, a step fault with the amplitude 0.15 occurs in 25 s\(\sim\)50 s, a periodic fault with the amplitude 0.25 occurs in 50 s\(\sim\)75 s, and then the fault ends. The fault \(\mathbf{f}(t)\) represent fluctuation of voltage, and it has the following forms  
\[\mathbf{f}(t)=\left\{ \begin{array}{ccc}0&0\,\mathrm{s}\leq t<25\,\mathrm{s}\\ 0.15&25\,\mathrm{s}\leq t<50\,\mathrm{s}\\ 0.25+0.01\sin(t-50)&50\,\mathrm{s}\leq t<75\,\mathrm{s}\\ 0&75\,\mathrm{s}\leq t<100\,\mathrm{s}\end{array} \right..\]  
The system output is shown in Figure 2.  
Figure 2: System output observation results. The state feedback of the system is \(\mathbf{u}(t)=-\mathbf{K}\mathbf{\dot{x}}(t)\), and the control gain is taken as follows  
\[\mathbf{K}=\left[ \begin{array}{ccc}-0.9595&9.0262\\ 15.1666&1.9720\\ 45.3628&10.9789\\ 2.8923&-24.5819\end{array} \right]^{\mathsf{T}}.\]  
Taking \(G=-1,\gamma=1\) and in order to solve Equation (7), it is easy to get  
\[\mathbf{K}_{i}=\left[ \begin{array}{ccc}0.8311&0.9568&5.9613\end{array} \right],\]  
\[\mathbf{K}_{p}=\left[ \begin{array}{ccc}-0.7599&-3.9856&1.6967\\ 1.2252&0.7122&-0.1788\\ 1.0291&4.2834&-1.5923\\ -0.2325&-0.9202&-0.0522\end{array} \right].\]  
The state observer Equation (4) is adopted, and the fault estimation results are as follows. It can be seen from Figure 3 that the state observer Equation (4) can track the real fault, but its tracking effect is not ideal. There is a certain deviation from the real fault, and the tracking of the sine function fault has hysteresis. Consider the nonlinear state observer Equation (13), which has the same gain matrix \(\mathbf{K}_{i},\mathbf{K}_{p}\).