## 5 Simulation and Analysis  
The simulations are executed to validate the effectiveness of the proposed method on a lab computer, with an Intel(r) Core(tm) i3-2120 3.3 GHz CPU with 2 GHz EMS memory, Windows XP as the operating system, and Matlab R2012a involved in the verification as the development environment. To be exact, let us suppose that the original position of the UAV is at \((2148\;\mathrm{m},28.5^{\circ},-5^{\circ})\), the original speed is \(25\;\mathrm{m/s}\), and \(V_{\mathrm{min}}=10\;\mathrm{m/s}\), \(V_{\mathrm{max}}=50\;\mathrm{m/s}\). The initial distance error of the inertial system is \((30\;\mathrm{m},30\;\mathrm{m},2\;\mathrm{m})\), its horizontal velocity error is \(2\;\mathrm{m/s}\), and its angle error is \(0.5^{\circ}\); furthermore, let \(a=10\), \(b=0.2\), that is to say, there is \(10\%\) distance uncertainty and \(0.2\%\) angle uncertainty in the error distribution of the system. The receding horizon control technique is adopted in order to get an optimal control sequence during the planning process. Specific speaking, six time steps corresponding to state evolutions of the system are planned at every discrete time simultaneously, but only the first control signal in the planned optimal control sequence of them is taken to act on the system, and the other five are abandoned. This process is repeated ceaselessly during the simulations; consequently, here \(H=6\), and the whole planning time \(T=250\;\mathrm{s}\). The flight path of the UAV is shown in Figure 5; from the simulation results we can see that the actual path based on the Q-learning method in this paper is almost identical to the standard path. Combined with the inertial navigation system, electronic compass, altitude indicator, and laser range finder fitted in the UAV, the combined fusion system ascertains the actual current position and state of the UAV itself according to the planning path that was obtained after the automatic pilot system manipulated the rudder plane at every discrete time. Figure 6 shows the estimated error between the planning path based on the method proposed in this paper and the standard path. The errors in the position and the flight attitude are both greatly suppressed during the simulations by using the method proposed in this paper. From the simulation results, we can see that the estimated error of the flight altitude is less than \(0.58\;\mathrm{m}\), the estimated error of the angle is less than \(0.04^{\circ}\), and the estimated error of the velocity in the horizontal direction is less than \(0.26\;\mathrm{m/s}\). Assuming that the threat is moving in a uniform straight line, the trajectory for the UAV to avoid the motion threat at different angles is given in Figure 7, where the red track is the trajectory of the motion threat and the black track is the trajectory of the UAV. The black dots in the threat trajectory are the waypoints predicted by Q-learning that may cause the conflict, and the black arrow indicates the direction of motion of the UAV and the threat, respectively. From Figure 7 we can see that, Although there is an intersection between the black and red trajectories, the intersection is where the threat and the UAV arrive at different times, so the two trajectories do not cause a risk of collision. Figure 5: Flight trajectory of the UAV. Figure 6: The estimated error between the planning path based on the method proposed in this paper and the standard path: (**a**) the estimated error of the flight altitude; (**b**) the estimated error of the azimuth angle; (**c**) the estimated error of the climbing angle; (**d**) the estimated error of the velocity in horizontal direction. Figure 7 examines six moving threat avoidance situations at the same speed and in different directions in our method, and we list the results in Table 1. From the statistics in Table 1, it can be seen that the minimum relative distance planned by the method in this paper can achieve the minimum flight safety distance specified in the general rules of flight safety.