Kalman Filter - CourseReps/ECEN489-Fall2015 GitHub Wiki
While calibrating the water flow sensor, we observed that the plot between flow rate and pump rate is not linear due to some noise or error in our measurements of flow rate or due to some process noise. The process model and the observation model of the flow rate after considering noise becomes
As there is some noise involved in our system, the flow rate at time t is not deterministic. So, we need a method to estimate the true value of the flow rate at time t given sensor observations (z) and control inputs (pumprate (p)).
Bayes Filter
Bayes Filter is one technique to do state estimation. It estimates the probability distribution of the state of the system (i.e., flowrate) given a sequence of sensor observations(z) and sequence of control inputs(p) i.e.,
and using bayes rule and other rules from probability theory, we get a recursive equation as follows
where
is the process model that says how does the system evolve from timestep t-1 to t given a control input P
is the observation model that gives the likelihood of an observation given the system is in a certain state
The Bayes filter can be divided into two steps
- Prediction Step
- Correction Step
The Bayes filter is just a general framework for recursive state estimation. It doesn't tell how to calculate those integrals and it doesn't tell about the models and the distributions involved.
one specific implementation of Bayes Filter is the Kalman filter. Kalman filter can be explained from various viewpoints but here it is explained using the Bayesian framework.
Kalman Filter
The kalman filter assumes that the distributions are Gaussian and the process model and the observation model are linear. If models are linear, then the kalman filter is the optimal estimator (i.e., there is no better way of estimating).
It also assumes the following about the process noise and the measurement noise
-
The mean of process noise and the measurement noise is zero
-
They are mutually uncorrelated i.e., the successive samples of the same noise are uncorrelated
The covariance (i.e., correlation in this case as the mean is zero)of process noise or measurement noise is given by

The process noise and measurement noise are also uncorrelated

- The initial value of the state is also considered to be a random variable with correlation zero
So, Now we can write the process model P(ft|ft-1,pt) under the above gaussian noise as
& the observation model P(Zt|ft) as
After performing some calculations, the mean and covariance of the flow rate at time t is given by the following equations and the estimated value of the flow rate at time t is given by mean.
Prediction Step
Correction Step
Where A = 1, B is the slope of the flow rate vs pump rate curve and C = 1 and Q and R are choosen randomly and Initial value of mean is zero and covariance can be choosen random but not zero and zt is the measurement from flow sensor at time t
i.e.,