Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-273

Kalman Covariance Update

Problem

Update the state covariance after a Kalman measurement update: p_new = (1 - k * h) * p_prior, where k is the Kalman gain, h the observation matrix, and p_prior the predicted variance.

This is the scalar form of the matrix update (I - K H) P.

Hint

A gain times observation matrix of 1 removes all prior variance.

Test cases

case 1
in: [1,1,0.5]
expected: 0.5
case 2
in: [2,1,0.25]
expected: 1.5
case 3
in: [3,0.5,0.4]
expected: 2.4000000000000004
case 4
in: [1,1,1]
expected: 0
Starter codePython
def kalman_covariance_update(p_prior, h, k):
    # Your code here
    pass

4 test cases · run your code against them in the editor