Kalman Filter Tool Calculator

Build a clear filter model in minutes here. Compare predictions, updates, gains, and errors easily. Download outputs to share with teams and clients securely.

Kalman Filter Settings
Reset
Pick a simple scalar model or constant-velocity tracking.
Example: 0.39, 0.50, 0.48 …
σ
If |y| > σ·√S, the update is skipped.
1D State-Space Parameters
Higher Q trusts model less, tracks faster.
Higher R trusts measurements less, smooths more.
2D Constant-Velocity Parameters
Use seconds, minutes, or any consistent unit.
Higher q allows more maneuvering.
Ppos Pvel
This mode observes position only. The filter estimates velocity from motion consistency.
Example Data Table
The example below runs the 2D constant-velocity mode using the default measurement list.
Step Measurement z Filtered position Estimated velocity Residual
1 0.3900 0.3824 0.1948 0.0076
2 0.5000 0.5046 0.1276 -0.0046
3 0.4800 0.5053 0.0387 -0.0253
4 0.2900 0.3461 -0.0972 -0.0561
5 0.2500 0.2497 -0.0966 0.0003
6 0.3200 0.2814 -0.0067 0.0386
Change variances to see smoothing versus responsiveness.
Formula Used

The filter alternates between a predict step and an update step. For the scalar (1D) model:

x̂ₖ⁻ = A·x̂ₖ₋₁ + B·u
Pₖ⁻ = A·Pₖ₋₁·Aᵀ + Q
yₖ = zₖ − H·x̂ₖ⁻
Sₖ = H·Pₖ⁻·Hᵀ + R
Kₖ = Pₖ⁻·Hᵀ·Sₖ⁻¹
x̂ₖ = x̂ₖ⁻ + Kₖ·yₖ
Pₖ = (I − Kₖ·H)·Pₖ⁻

For constant-velocity tracking (2D), the state is [position, velocity]ᵀ and:

  • A = [[1, Δt], [0, 1]] and H = [1, 0].
  • Process noise uses acceleration variance q: Q = q·[[Δt⁴/4, Δt³/2],[Δt³/2, Δt²]].
  • Innovation gating (optional): if |y| > σ·√S, the update is skipped.
How to Use This Calculator
  1. Paste measurements into the Measurements (z) box.
  2. Select a model mode: 1D for generic smoothing, 2D for motion tracking.
  3. Set uncertainty values: Q/q for model noise, R for sensor noise.
  4. Optionally enable gating to reduce outlier impact.
  5. Press Submit to see the full step-by-step table.
Practical tuning hints
  • If the estimate lags behind changes, increase Q (or q).
  • If the estimate is too noisy, increase R.
  • Start with larger P₀ when initial state is uncertain.

State and Measurement Design

Choose a state that matches the data you collect. In 1D mode, the single state can represent a level or smoothed signal. In 2D mode, the state is position and velocity, while measurements observe position only. Use a consistent unit system for z and Δt; if z is meters and Δt is seconds, velocity is meters per second. When the sampling interval changes, rerun with the new Δt.

Noise Variance Selection

R represents sensor variance, so a starting value is the sample variance of repeated readings taken at rest. Q (or q in 2D) represents model uncertainty; increasing it makes the estimate react faster to real changes. If the output looks jittery, raise R or lower Q. If the estimate lags turning points, raise Q or q. Keep variances non‑negative and scaled to the squared unit of z.

Understanding Gains and Covariance

The gain controls how strongly each measurement updates the prediction. Large gain appears when P_pred is high or R is low, meaning the filter trusts the measurement. Small gain appears when the model is confident or the sensor is noisy. Watch P shrink over steps; decreasing covariance indicates the filter is learning a stable state. In 2D mode, P00 tracks position uncertainty and P11 tracks velocity uncertainty, which stabilizes after several samples.

Outlier Control with Innovation Gating

Innovation y is the difference between the measurement and predicted observation. With gating enabled, the tool compares |y| to σ·√S, where S is innovation variance. A σ setting of 3 keeps 99.7% of Gaussian innovations, while σ around 2 is stricter. When updates are skipped, the estimate still propagates through prediction, preserving continuity. Frequent skips suggest R is too small, Q is too small, or the data shifted.

Reporting and Validation Metrics

Use residuals to check calibration: filters produce residuals centered near zero with variance close to S. The tool reports RMSE and MAE across steps; RMSE penalizes errors, while MAE is robust to spikes. Compare metrics across parameter sets and keep the configuration that minimizes error without excessive lag. Export CSV to audit each step quickly, and use the PDF report for reviews.

FAQ 1: What do Q and R represent?

Q (or q) captures how much the model can drift between steps. R captures measurement noise. Higher Q follows changes faster; higher R smooths more by trusting measurements less.

FAQ 2: When should I use 1D versus 2D mode?

Use 1D to smooth a single noisy series (level, bias, index). Use 2D when readings are positions over time and you want an implied velocity estimate.

FAQ 3: How should I set the initial covariance?

Start larger when the initial state is uncertain. If the filter overreacts early, reduce P0/Ppos/Pvel. If it ignores early measurements, increase the initial covariance.

FAQ 4: What does innovation gating change?

Gating skips updates when a measurement looks like an outlier, using |y| compared with σ·√S. The filter still predicts forward, so the estimate remains continuous.

FAQ 5: Why is the Kalman gain very small or very large?

Gain rises when prediction uncertainty is high or R is low, so measurements dominate. Gain falls when the model is confident or R is high, so predictions dominate.

FAQ 6: What should I export and review first?

Export CSV to inspect step-by-step residuals, gains, and accepted updates. Use the PDF when you need a fixed report for sharing, audits, or review meetings.

Related Calculators

Holt Winters ToolDifferencing CalculatorAnomaly Detection ToolFourier Transform ToolSpectral Density ToolChange Point DetectorGranger Causality ToolState Space ModelNaive Forecast Tool

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.