Particle Filter
Track a moving point from noisy observations; compare particle weights, effective sample size and resampling.
About this tool
Model. Track 100 observations of a deterministic example target on a 720 × 420 model-pixel field. It starts at (80, 210) and moves by (2.2, 0.8) px per observation. Independent Gaussian measurement errors have standard deviation σᵣ in each axis. Screen size does not change model coordinates.
Filter. The initial position prior is uniform over the field; each velocity component is uniform from −3 to 3 px/observation. The filter assumes uncertain motion: each update adds independent U(−1, 1) position noise and U(−0.25, 0.25) velocity noise. Position uses the previous velocity. Thus Q = diag(1/3, 1/3, 1/48, 1/48) per discrete update in state order (x, y, vx, vy).
Weights. The plot, estimate and ESS use the normalized posterior before resampling. Weight controls particle prominence. ESS = 1/Σw²; systematic resampling occurs when ESS < N/2. Descendants have equal weights; otherwise weights carry into the next observation. High ESS does not guarantee low error or diverse ancestors. Coordinates outside the model rectangle are clipped only in the drawing.
Controls. One observation advances exactly once and pauses; Reset restores the seeded prior and pauses. N, σᵣ and seed changes require a fresh run. Playback changes preserve state. Separate random streams keep observations identical when N changes. Navigation retains input drafts, not live trajectories. Hidden views suspend playback; reduced motion makes a fresh Start prepare a paused prior.
References. Doucet and Johansen: particle filtering and ESS; Douc, Cappé and Moulines: resampling schemes.