rlabbe / Kalman-and-Bayesian-Filters-in-Python

Kalman Filter book using Jupyter Notebook. Focuses on building intuition and experience, not formal proofs. Includes Kalman filters,extended Kalman filters, unscented Kalman filters, particle filters, and more. All exercises include solutions.
Other
16.57k stars 4.18k forks source link

Variance #406

Open 83aqua opened 2 years ago

83aqua commented 2 years ago

Chapter-06

import math
import numpy as np
from numpy.random import randn

def compute_dog_data(z_var, process_var, count=1, dt=1.):
    "returns track, measurements 1D ndarrays"
    x, vel = 0., 1.
    z_std = math.sqrt(z_var) 
    p_std = math.sqrt(process_var)
    xs, zs = [], []
    for _ in range(count):
        v = vel + (randn() * p_std)
        x += v*dt        
        xs.append(x)
        zs.append(x + randn() * z_std)        //wont the Variance of Zs become z_var+process_var?
    return np.array(xs), np.array(zs)

wont the Variance of Zs become z_var+process_var?

PebetoUofC commented 2 years ago

We have:

measurement = position + error_in_measurement, where error_in_measurement is drawn from a normal with mean 0 and standard error equals to the standard error of the measurement z_std