
This article introduces a real-time trajectory discrimination system, which aims to determine the most likely trajectory of a ground target in real-time based on noisy trajectory data when multiple candidate trajectories are known.
<span>Code download link included. Original program, all handwritten, no AI auto-generated content, with Chinese comments.</span>
Table of Contents
- Program Results
- Traditional Methods
- Improved Methods
- MATLAB Code
The code described in this article is a real-time trajectory discrimination system, which determines in real-time the most likely trajectory of a target based on its noisy trajectory data when multiple candidate trajectories are known.
The core functionalities include:
-
Construction and display of multiple candidate trajectories: The program supports any number of trajectories (6 trajectories generated in the example) and displays all candidate trajectories in the graph.
-
Simulation of noisy real target trajectories: By adding noise to the real trajectory, an observation sequence is generated to serve as the “target to be classified”.
-
Distance-based “trajectory likelihood” calculation: At each moment, the program calculates the minimum distance between the current position of the target and all candidate trajectories, converting the distance into a likelihood value using a Gaussian kernel function:
- The closer to a trajectory ⇒ the greater the likelihood of that trajectory
- The farther away ⇒ the smaller the likelihood

- Incorporation of all historical information for “cumulative Bayesian probability update”: using recursive probability update methods
- Current trajectory probability = Previous probability × Current likelihood
- Then normalize all trajectories
Thus, the judgment result not only depends on the current moment’s error but also continuously accumulates judgments from all past moments,becoming more stable and accurate over time.<span>This is the main innovation point.</span>
-
Real-time output of trajectory probability change curves: The program dynamically displays the probability curves of each trajectory over time.The probability of the correct trajectory gradually approaches 1, while other trajectories decay to near 0.
<span>This is a secondary innovation point.</span> -
Final output of the most likely real trajectory number

Program Results
All possible trajectories are automatically and randomly generated.
Setting the 5th trajectory as the real trajectory, below are the results:
Traditional Methods
As shown in the figure, the probability curve fluctuates frequently, resulting in incorrect outcomes:
Improved Methods
Below are the results of the improved methods, where the curve converges quickly, allowing for rapid identification of the green line as the real trajectory:
The result is also correct.
MATLAB Code
Code access:
https://mall.bilibili.com/neul-next/detailuniversal/detail.html?isMerchant=1&page=detailuniversal_detail&saleType=10&itemsId=13570346&loadingShow=1&noTitleBar=1&msource=merchant_share
Or click on “Read the original text” at the end to jump.
<span>If you need assistance or have custom code requirements related to navigation and positioning filtering, please contact the author:</span>
