Kalman Filter Gain Calculator

Compute the steady-state Kalman gain and error covariance for a scalar system from its process and measurement noise variances.

🧭 Kalman Filter Gain Calculator
a
c
Process noise variance (Q)1
0.0110
Measurement noise variance (R)4
0.0120
Steady-state gain K
A-priori covariance P
A-posteriori covariance Ppost
Step-by-step working

🧭 What is Kalman Filter Gain?

The Kalman filter is a recursive algorithm that produces a statistically optimal estimate of a system's hidden state from a stream of noisy measurements, combined with a known model of how the state evolves. The Kalman gain is the number (or matrix, for multi-state systems) that decides, at each step, how much weight to give the newest measurement versus the filter's own model-based prediction. After enough measurements, this gain converges to a fixed steady-state value, the quantity this calculator computes directly, without iterating the filter step by step.

Engineers use Kalman filtering wherever a true state must be estimated from imperfect sensors. A navigation engineer fusing noisy GPS position readings with an inertial motion model uses the Kalman gain to blend the two into a smoother, more accurate position estimate. A battery management system estimating state of charge from noisy voltage and current sensors uses the same recursive update. A radar tracking system estimating a target's position and velocity from noisy range measurements relies on exactly this gain to weigh new returns against its predicted track.

A common misconception is that the Kalman gain must be recomputed by simulating the full time-varying recursion from scratch every time. In reality, for a fixed, time-invariant system (constant a, c, Q, R), the gain settles to a single steady-state value after a short transient, and that steady-state value can be solved directly from the discrete algebraic Riccati equation without simulating the recursion at all, exactly what this calculator's closed-form quadratic solution does.

This calculator takes a scalar (single-state) discrete-time plant's coefficients a and c, plus the process noise variance Q and measurement noise variance R, and returns the steady-state Kalman gain K, the a-priori and a-posteriori error covariances, and a chart showing the Riccati recursion converging to that steady-state value from an initial guess, so you can see how quickly (and to what value) the filter actually settles.

📐 Formula

P  =  (−B + √(B²+4c²QR)) / (2c²)     K  =  Pc / (c²P + R)
Plant model: x[k+1] = a·x[k] + w[k], measurement: y[k] = c·x[k] + v[k], with w ~ N(0,Q) and v ~ N(0,R)
Scalar discrete algebraic Riccati equation: P = a²PR / (c²P+R) + Q, rearranged into the quadratic c²P² + [R(1−a²) − Qc²]P − QR = 0
B = R(1−a²) − Qc², the quadratic's middle coefficient
A-posteriori covariance: Ppost = (1 − Kc)P
Example: a = 1, c = 1, Q = 1, R = 4 → B = −1, P ≈ 2.5616, K ≈ 0.3904, Ppost ≈ 1.5616.

📖 How to Use This Calculator

Steps

1
Enter the plant and measurement coefficients. Type a, the scalar state transition coefficient, and c, the measurement gain relating the state to the observed output.
2
Enter the process and measurement noise variances. Type Q, the process noise variance, and R, the measurement noise variance.
3
Read the steady-state gain, covariances, and convergence chart. See the steady-state Kalman gain K, the a-priori and a-posteriori error covariances, and the chart showing the covariance converging to its steady-state value.

💡 Example Calculations

Example 1 — Random Walk With a Noisy Sensor

a = 1, c = 1, Q = 1, R = 4

1
B = R(1−a²) − Qc² = 4(1−1) − 1(1) = −1
2
Discriminant = B² + 4c²QR = 1 + 16 = 17; P = (1 + √17)/2 ≈ 2.5616
3
K = Pc/(c²P+R) = 2.5616/6.5616 ≈ 0.3904; Ppost = (1−0.3904)(2.5616) ≈ 1.5616
Steady-state K ≈ 0.3904, P ≈ 2.5616, Ppost1.5616
Try this example →

Example 2 — Stable Process With Balanced Noise

a = 0.9, c = 1, Q = 0.5, R = 1

1
B = 1(1−0.81) − 0.5(1) = 0.19 − 0.5 = −0.31
2
Discriminant = 0.31² + 4(1)(0.5)(1) = 0.0961 + 2 = 2.0961; P = (0.31 + √2.0961)/2 ≈ 0.8789
3
K = 0.8789/1.8789 ≈ 0.4678; Ppost = (1−0.4678)(0.8789) ≈ 0.4678
Steady-state K ≈ 0.4678, P ≈ 0.8789, Ppost0.4678
Try this example →

Example 3 — A More Sensitive Sensor

a = 1, c = 2, Q = 1, R = 9

1
B = 9(1−1) − 1(4) = 0 − 4 = −4
2
Discriminant = 16 + 4(4)(1)(9) = 16 + 144 = 160; P = (4 + √160)/8 ≈ 2.0811
3
K = 2(2.0811)/(4(2.0811)+9) ≈ 0.2403; Ppost = (1−2(0.2403))(2.0811) ≈ 1.0811
Steady-state K ≈ 0.2403, P ≈ 2.0811, Ppost1.0811
Try this example →

❓ Frequently Asked Questions

What is a Kalman filter and what does the Kalman gain do?+
A Kalman filter is a recursive algorithm that produces an optimal (minimum-variance) estimate of a system's state from noisy measurements and a known process model. The Kalman gain K sets how much the new measurement corrects the prediction at each step, a gain near 1 trusts the measurement, a gain near 0 trusts the prediction.
How do you calculate the steady-state Kalman gain for a scalar system?+
For x[k+1] = a*x[k] + w[k] and y[k] = c*x[k] + v[k] with noise variances Q and R, the steady-state a-priori error covariance P solves c^2*P^2 + [R(1-a^2) - Q*c^2]*P - Q*R = 0. Taking the positive root gives P, then the steady-state gain is K = Pc / (c^2*P + R).
What is the discrete algebraic Riccati equation?+
It is the fixed-point equation the error covariance satisfies once the Kalman filter's time-varying gain has converged: P = a^2*P*R/(c^2*P+R) + Q for the scalar case. Solving it directly, instead of iterating the filter recursion many times, gives the steady-state covariance and gain in one step.
Why does the calculator take only the positive root of the Riccati quadratic?+
The quadratic c^2*P^2 + [R(1-a^2) - Q*c^2]*P - Q*R = 0 always has one positive and one negative root, since the product of its roots equals minus Q*R divided by c^2, which is negative whenever Q and R are positive. Only the positive root is a physically valid error covariance.
What is the difference between the a-priori and a-posteriori covariance?+
The a-priori covariance P is the estimation-error variance right after the prediction step, before that step's measurement is used. The a-posteriori covariance P_post is the variance right after incorporating the measurement, it is always smaller than or equal to P since a measurement can only add information, never remove it.
How many iterations does the Kalman filter take to reach steady state?+
For most stable scalar and low-order systems, the error covariance converges to within a fraction of a percent of its steady-state value within 10 to 20 iterations, the convergence chart on this page plots exactly this recursion so you can see how quickly it settles for your own a, c, Q, and R.
What happens to the Kalman gain if measurement noise R is very large?+
As R grows relative to Q, the steady-state gain K approaches 0, meaning the filter almost entirely trusts its own model prediction and nearly ignores each new noisy measurement, since a very noisy sensor carries little useful information about the true state.
What happens to the Kalman gain if process noise Q is very large?+
As Q grows relative to R, the steady-state gain K approaches 1/c, meaning the filter trusts each new measurement almost completely and barely uses its own prediction, since a highly uncertain process model makes the prediction step unreliable compared to the sensor.
Does this calculator handle multi-state (vector) Kalman filters?+
No, this calculator is deliberately scoped to the scalar (single-state) case, which has an exact closed-form solution. General multi-state systems require solving a matrix algebraic Riccati equation, which almost always needs an iterative numerical solver rather than a single formula.
Is the Kalman filter the same as a Luenberger observer?+
No. Both estimate a system's state from measurements, but a Luenberger observer places the estimation-error poles at chosen locations with no explicit noise model, while a Kalman filter computes the gain that statistically minimizes estimation-error variance given known noise covariances. See the Observer (Luenberger Estimator) Calculator on this site for the pole-placement approach.
Can the Kalman gain be negative?+
For this scalar formulation with positive c, Q, and R, the steady-state gain K is always positive, since it equals Pc/(c^2*P+R) with P, c, and the denominator all positive. A negative measurement gain c would flip the sign of K, but the physical interpretation (trusting measurements more or less) stays the same.

What is a Kalman filter and what does the Kalman gain do?

A Kalman filter is a recursive algorithm that produces an optimal (minimum-variance) estimate of a system's state from noisy measurements and a known process model. The Kalman gain K sets how much the new measurement corrects the prediction at each step, a gain near 1 trusts the measurement, a gain near 0 trusts the prediction.

How do you calculate the steady-state Kalman gain for a scalar system?

For x[k+1] = a*x[k] + w[k] and y[k] = c*x[k] + v[k] with noise variances Q and R, the steady-state a-priori error covariance P solves c^2*P^2 + [R(1-a^2) - Q*c^2]*P - Q*R = 0. Taking the positive root gives P, then the steady-state gain is K = Pc / (c^2*P + R).

What is the discrete algebraic Riccati equation?

It is the fixed-point equation the error covariance satisfies once the Kalman filter's time-varying gain has converged: P = a^2*P*R/(c^2*P+R) + Q for the scalar case. Solving it directly, instead of iterating the filter recursion many times, gives the steady-state covariance and gain in one step.

Why does the calculator take only the positive root of the Riccati quadratic?

The quadratic c^2*P^2 + [R(1-a^2) - Q*c^2]*P - Q*R = 0 always has one positive and one negative root, since the product of its roots equals minus Q*R divided by c^2, which is negative whenever Q and R are positive. Only the positive root is a physically valid error covariance.

What is the difference between the a-priori and a-posteriori covariance?

The a-priori covariance P is the estimation-error variance right after the prediction step, before that step's measurement is used. The a-posteriori covariance P_post is the variance right after incorporating the measurement, it is always smaller than or equal to P since a measurement can only add information, never remove it.

How many iterations does the Kalman filter take to reach steady state?

For most stable scalar and low-order systems, the error covariance converges to within a fraction of a percent of its steady-state value within 10 to 20 iterations, the convergence chart on this page plots exactly this recursion so you can see how quickly it settles for your own a, c, Q, and R.

What happens to the Kalman gain if measurement noise R is very large?

As R grows relative to Q, the steady-state gain K approaches 0, meaning the filter almost entirely trusts its own model prediction and nearly ignores each new noisy measurement, since a very noisy sensor carries little useful information about the true state.

What happens to the Kalman gain if process noise Q is very large?

As Q grows relative to R, the steady-state gain K approaches 1/c, meaning the filter trusts each new measurement almost completely and barely uses its own prediction, since a highly uncertain process model makes the prediction step unreliable compared to the sensor.

Does this calculator handle multi-state (vector) Kalman filters?

No, this calculator is deliberately scoped to the scalar (single-state) case, which has an exact closed-form solution. General multi-state systems require solving a matrix algebraic Riccati equation, which almost always needs an iterative numerical solver rather than a single formula.

Is the Kalman filter the same as a Luenberger observer?

No. Both estimate a system's state from measurements, but a Luenberger observer places the estimation-error poles at chosen locations with no explicit noise model, while a Kalman filter computes the gain that statistically minimizes estimation-error variance given known noise covariances. See the Observer (Luenberger Estimator) Calculator on this site for the pole-placement approach.

Can the Kalman gain be negative?

For this scalar formulation with positive c, Q, and R, the steady-state gain K is always positive, since it equals Pc/(c^2*P+R) with P, c, and the denominator all positive. A negative measurement gain c would flip the sign of K, but the physical interpretation (trusting measurements more or less) stays the same.