Inferensys

Glossary

Extended Kalman Filter (EKF)

The Extended Kalman Filter (EKF) is a nonlinear state estimation algorithm that linearizes system and measurement models around the current state estimate to handle real-world sensor fusion in robotics and autonomous systems.
ML engineer running AI model benchmarks, performance charts on multiple screens, late night home office setup.
STATE ESTIMATION

What is Extended Kalman Filter (EKF)?

The Extended Kalman Filter (EKF) is a foundational algorithm in robotics and autonomous systems for estimating the state of a nonlinear dynamic system from noisy sensor measurements.

The Extended Kalman Filter (EKF) is a nonlinear state estimation algorithm that linearizes a system's dynamics and measurement models around the current state estimate to apply the standard Kalman filter equations. It recursively predicts a system's future state using a motion model and corrects that prediction by fusing incoming sensor data, all while maintaining a Gaussian approximation of the estimation uncertainty. This makes it a core tool for sensor fusion and localization in Simultaneous Localization and Mapping (SLAM) and robotic navigation.

The EKF operates in a two-step predict-update cycle. The prediction step uses the nonlinear process model to project the state and its covariance forward. The update step linearizes the measurement model at the predicted state to compute the Kalman gain, which optimally weights the new sensor observation against the prediction. While powerful, its reliance on first-order Taylor expansion for linearization can introduce significant error for highly nonlinear systems or poor initial estimates, leading to filter divergence—a limitation addressed by more advanced filters like the Unscented Kalman Filter (UKF).

NONLINEAR STATE ESTIMATION

Key Characteristics of the EKF

The Extended Kalman Filter (EKF) is the de facto standard for real-time state estimation in nonlinear systems, such as robotics and autonomous vehicles. It extends the classical Kalman Filter by linearizing the system's dynamics and measurement models around the current state estimate.

01

First-Order Taylor Expansion

The core mechanism of the EKF is the linearization of nonlinear functions via a first-order Taylor expansion. For a nonlinear state transition function f(x) and measurement function h(x), the EKF computes Jacobian matrices F and H. These matrices, which contain the partial derivatives of the functions with respect to the state, are evaluated at the current state estimate (). This linear approximation allows the filter to propagate the Gaussian uncertainty through the nonlinear models, a process the standard Kalman Filter cannot perform.

  • State Transition Jacobian (F): Fₖ = ∂f/∂x |ₓ=ₓ̂ₖ₋₁
  • Measurement Jacobian (H): Hₖ = ∂h/∂x |ₓ=ₓ̂ₖ₋
02

Predict-Update Cycle

The EKF operates in a recursive two-step cycle, maintaining a state estimate and its associated error covariance matrix P.

1. Prediction Step:

  • Projects the state forward using the nonlinear model: x̂ₖ₋ = f(x̂ₖ₋₁, uₖ).
  • Projects the covariance forward using the linearized model: Pₖ₋ = Fₖ Pₖ₋₁ Fₖᵀ + Qₖ. Q is the process noise covariance.

2. Update (Correction) Step:

  • Computes the Kalman Gain Kₖ, which weights the confidence between the prediction and the new measurement zₖ.
  • Updates the state estimate by incorporating the measurement residual: x̂ₖ = x̂ₖ₋ + Kₖ (zₖ - h(x̂ₖ₋)).
  • Updates the covariance to reflect the reduced uncertainty: Pₖ = (I - Kₖ Hₖ) Pₖ₋.
03

Applications in SLAM & Robotics

The EKF is a foundational algorithm in Simultaneous Localization and Mapping (SLAM) and robotic state estimation. Its ability to fuse asynchronous, multi-modal sensor data into a single consistent state estimate is critical for autonomy.

  • Visual-Inertial Odometry (VIO): Fuses camera features with IMU data to estimate 6-DOF pose.
  • LiDAR Odometry: Estimates robot motion by matching consecutive LiDAR scans.
  • Sensor Fusion: Integrates GPS, wheel encoders (odometry), and IMU data for robust localization.
  • Landmark-based SLAM (EKF-SLAM): Maintains a joint state vector containing both the robot pose and the estimated positions of observed landmarks in the map, updating them simultaneously.
04

Limitations and Failure Modes

While powerful, the EKF has well-understood limitations that engineers must design around.

  • Linearization Error: The first-order approximation is only valid locally. For highly nonlinear systems or large uncertainties, the linearization can introduce significant error, causing filter divergence.
  • Computational Cost: The need to compute Jacobians analytically or via numerical differentiation at each step adds overhead. The covariance update is O(n²) in the state dimension n.
  • Gaussian Assumption: The EKF assumes all uncertainties are Gaussian. It cannot represent multi-modal distributions, which can occur during data association ambiguity or symmetric environments.
  • Susceptibility to Outliers: The filter relies on correct data association. Incorrect matching of sensor observations to map landmarks can catastrophically corrupt the state estimate.
05

Comparison to Other Filters

The EKF sits within a family of Bayesian filters, each with different trade-offs.

  • vs. Kalman Filter (KF): The KF is optimal for linear Gaussian systems. The EKF is a heuristic but effective extension for nonlinear systems.
  • vs. Unscented Kalman Filter (UKF): The UKF uses a deterministic sampling approach (the unscented transform) to propagate uncertainty through nonlinear functions, often providing better accuracy than the EKF's Jacobian-based linearization, especially for strong nonlinearities.
  • vs. Particle Filter: Particle filters represent the state distribution with a set of samples, making them capable of modeling non-Gaussian, multi-modal distributions. However, they are typically far more computationally expensive than the EKF, making the EKF preferable for high-frequency, embedded real-time systems where the Gaussian assumption holds.
06

Practical Implementation Notes

Successfully deploying an EKF requires careful engineering beyond the core algorithm.

  • Jacobian Computation: Use automatic differentiation (e.g., via ceres-solver or jax) for reliability and to avoid manual derivation errors.
  • Tuning Noise Covariances (Q, R): The process noise Q and measurement noise R matrices are critical tuning parameters. They are often determined empirically or via system identification.
  • Numerical Stability: Use the Joseph form for the covariance update (Pₖ = (I - Kₖ Hₖ) Pₖ₋ (I - Kₖ Hₖ)ᵀ + Kₖ Rₖ Kₖᵀ) to ensure P remains symmetric positive definite.
  • Initialization: The filter requires a good initial state estimate x̂₀ and covariance P₀. Poor initialization can lead to slow convergence or divergence.
FILTER COMPARISON

EKF vs. Other State Estimation Filters

A technical comparison of the Extended Kalman Filter (EKF) against other common state estimation algorithms used in robotics and SLAM, highlighting their mathematical foundations, performance characteristics, and suitability for different system dynamics.

Feature / MetricExtended Kalman Filter (EKF)Kalman Filter (KF)Unscented Kalman Filter (UKF)Particle Filter (PF)

Core Mathematical Approach

First-order Taylor series linearization of nonlinear models around the current estimate.

Optimal linear estimator for systems with Gaussian noise.

Uses deterministic sigma points to propagate mean and covariance through nonlinear functions (unscented transform).

Sequential Monte Carlo method using a set of weighted samples (particles) to represent the posterior distribution.

Handles Nonlinear System Dynamics

Handles Non-Gaussian Noise

Computational Complexity

O(n³) for covariance update, where n is state dimension.

O(n³), but typically with smaller matrices for linear models.

O(n³), similar to EKF but often requires more sigma point propagations.

O(N·n), where N is the number of particles (can be very high).

Typical State Dimensionality

Medium (e.g., 6-15 DOF for robot pose + landmarks).

Low to Medium (linear systems).

Medium (similar to EKF).

Low to Medium (high dimensionality leads to particle depletion).

Representation of Posterior Distribution

Single Gaussian (mean and covariance).

Single Gaussian (mean and covariance).

Single Gaussian (mean and covariance).

Arbitrary distribution (approximated by particle set).

Primary Use Case in SLAM/Robotics

Feature-based Visual SLAM, sensor fusion for moderately nonlinear systems.

Linear tracking problems, basic sensor fusion (e.g., fusing GPS + IMU with linear models).

Highly nonlinear sensor fusion where derivative calculation is difficult (e.g., certain orientation estimations).

Global localization, non-Gaussian tracking problems (e.g., kidnapped robot problem).

Susceptibility to Linearization Error

High - Performance degrades with strong nonlinearities or poor initial estimates.

Not Applicable - Assumes linearity.

Low - More accurate mean/covariance propagation than EKF for strong nonlinearities.

None - Does not rely on linearization.

Real-Time Performance

Good for moderate state sizes.

Excellent.

Good, slightly heavier than EKF due to sigma point propagation.

Poor to Fair, heavily dependent on particle count; often not used for high-rate SLAM front-ends.

EXTENDED KALMAN FILTER

Frequently Asked Questions

The Extended Kalman Filter (EKF) is a cornerstone algorithm for state estimation in nonlinear robotic systems. These questions address its core mechanics, applications, and trade-offs within the context of Simultaneous Localization and Mapping (SLAM) and embodied intelligence.

An Extended Kalman Filter (EKF) is a nonlinear state estimation algorithm that linearizes a system's dynamics and measurement models around the current state estimate to recursively compute optimal predictions and updates. It works by maintaining a Gaussian belief over the system's state (e.g., a robot's pose and velocity), characterized by a mean vector and a covariance matrix. The process follows a two-step cycle:

  1. Prediction Step: The filter uses the nonlinear motion model to predict the next state mean and propagates the uncertainty (covariance) forward in time.
  2. Update (Correction) Step: When a new sensor measurement arrives, the filter linearizes the nonlinear measurement model around the predicted state. It then computes the Kalman gain, which optimally weights the prediction against the new measurement to produce a corrected state estimate with reduced uncertainty.

This linearization via a first-order Taylor expansion is the core extension that allows the classic Kalman filter to handle nonlinearities inherent in robotics, such as rotational motion or perspective camera models.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.