Each fixed BLE beacon broadcasts at a known reference power. The phone inverts the log-distance path-loss model to turn its measured signal strength into an estimated range:
RSSI(d) = TxPower − 10·n·log10(d) + noise
d_est = 10 ^ ((TxPower − RSSI) / (10·n))
Instead of solving a fresh least-squares fix every frame, this tracker runs an Extended Kalman Filter over a constant-velocity motion model — the same estimator class used in real dead-reckoning / sensor-fusion pipelines. The state is position and velocity, x = [px, py, vx, vy]:
predict: x⁻ = F·x P⁻ = F·P·Fᵀ + Q
measure: r̂ᵢ = ‖(px,py) − beaconᵢ‖
Hᵢ = [ (px−bxᵢ)/r̂ᵢ , (py−byᵢ)/r̂ᵢ , 0, 0 ]
Kᵢ = P⁻·Hᵢᵀ / (Hᵢ·P⁻·Hᵢᵀ + R)
x = x⁻ + Kᵢ·(dᵢ − r̂ᵢ) P = (I − Kᵢ·Hᵢ)·P⁻
Each active beacon's range applies its own scalar correction in turn every frame, and the motion model itself predicts forward between updates — so unlike a pure algebraic solve, the filter keeps producing a (growing-uncertainty) estimate even with only one or two beacons visible, rather than becoming undefined. The dashed circle around each beacon is literally its current noisy range estimate; where several circles cross is the raw geometric fix the filter is correcting toward. The solid ellipse around the red marker is the filter's own 95% position-uncertainty ellipse, drawn from the eigenvalues of its covariance matrix — it visibly shrinks with more beacons and lower noise, and swells when the geometry is poor.
Filter motion trust q sets the process-noise (assumed acceleration variance) — low q makes the filter trust its constant-velocity prediction and smooth over noisy readings (at the cost of lag when the phone changes direction); high q makes it snap to each new measurement. Note that because a fixed dB noise σ converts to a smaller metre-noise at higher n (division by n in the exponent), raising the path-loss exponent alone can look like it tightens the fix in this model — in a real cluttered room, a higher n usually also brings additional multipath bias that this simplified noise model does not add, so watch the trilateration circles' spread for the honest picture, not RMSE alone.