kalman filter: understanding the mathematical part - MathOverflow most recent 30 from http://mathoverflow.net 2013-05-24T09:47:39Z http://mathoverflow.net/feeds/question/39074 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/39074/kalman-filter-understanding-the-mathematical-part kalman filter: understanding the mathematical part maximus 2010-09-17T08:37:16Z 2010-09-20T13:38:55Z <p>i am currently reading the Probabilistic robotics book where the filters are discussed. Such filters as kalman filter or particle filters. Now I can understand one thing while reading about the Kalman filter. First I want to say that I could successfully understand about Bayes filtering. I've read some of theory of random processes and I can understand it. Let me give you some details about the problem, if you think it is not sufficient I will give more. Who knows about that book I write here the page: it is about Kalman filter at page 41. Let me not to explaing the whole problem, I hope the reader could be able to understand it as it is related with Kalman filtering. However I will write more if it is needed. 1. The state transition probability $p(x_t|u_t, x_{t-1})$ must be a linear function in its arguments with added Gaussian noise. This is expressed by the following equation: $$x_t = A_t x_{t-1} + B_t u_t + \epsilon_t (1)$$ $x_t$ and $x_{t-1}$ are state vectors, and $u_t$ is a control vector at time $t$. $\epsilon_t$ is a gaussian noise.</p> <p>Also it is given the definition of multivariant normal distribution: $$p(x) = det\left(2\pi\Sigma\right)^{-1/2}exp\left(-1/2(x-\mu)^T\Sigma^{-1}(x-\mu)\right) (2)$$ Where the $\mu$ and $\Sigma$ are the mean and covariance. The $x_t$ and $u_t$ are of the form: $$x_t = \left(x_{1,t}, x_{2,t}, ..., x_{n,t}\right)^T$$ $$u_t = \left(u_{1,t}, u_{2,t}, ..., u_{m,t}\right)^T$$ So it is said that in order to obatain the state transition probability $p(x_t|u_t, x_{t-1})$ you need to plugg the equation $(1)$ to the multivariant normal distribution (2).</p> <p>Ok, I got that, but it is also written there that (here is the problem): The mean of the posterior state is given by: $A_tx_{t-1}+B_tu_t$ and the covariance by $R_t$ What I can't understand is that how does the mean in the multivariant normal distribution equation $(2)$ is calculated to $A_tx_{t-1}+B_tu_t$? The whole formula affter plugging $(1)$ to $(2)$ become: $$p(x_t|u_t, x_{t-1}) = det\left(2\pi R_t\right)^{-1/2}exp\left(-1/2(x_t-A_tx_{t-1}-B_tu_t)^TR_t^{-1}(x_t-A_tx_{t-1}-B_tu_t)\right)$$</p> <p>I think that the mean of $x_t$ should be calculated like this: $$E{x_t} = E(A_tx_{t-1}+B_tu_t+\epsilon_t)$$ $$E{x_t} = A_tE(x_{t-1})+E(B_tu_t)$$ And I can't understand anyway how does the $Ex_t$ is equal to $A_tx_{t-1}+B_tu_t$ If you see any mistakes in my reasoning please tell me. If you need more details please comment this question for that. Thank you very much! Hope you help!</p> <p>EDIT 1:</p> <p>From book it is said that Kalman Filter (KF) is an implementation of Bayes Filter(BF). I understood BF. Actually it calculates belief $bel(x_t)$ at time $t$ from belief at time $t-1$. BF algorithm:</p> <pre><code>For all $x_t$: </code></pre> <p>$\hat{bel}(x_t) = \int{p(x_t|u_t, x_{t-1})bel(x_{t-1})dx_{t-1}}$</p> <p>$bel(x_t) = \etap(z_t|x_t)\hat{bel}(x_t)$</p> <pre><code>end for return $bel(x_t)$ </code></pre> <p>So about KF: $$\hat{bel}(x_t) = \int{p(x_t|x_{t-1}, u_t)bel(x_{t-1})dx_{t-1}}$$ where $bel(x_{t-1})$ is represented by mean $\mu_{t-1}$ and covariance $\Sigma_{t-1}$ The state transition probability $p(x_t|x_{t-1}, u_t)$ is given as a normal distribution over $x_t$ with mean $A_tx_{t-1}+B_tu_t$ and covariance $R_t$.</p> <p>If $x_t$ can't be observed directly, so then what is $E(x_t)$?</p> http://mathoverflow.net/questions/39074/kalman-filter-understanding-the-mathematical-part/39082#39082 Answer by arsmath for kalman filter: understanding the mathematical part arsmath 2010-09-17T10:44:56Z 2010-09-20T13:38:55Z <p>Do you really mean $Ex_t$? That's the unconditional mean without looking at any of the data, which is a constant. Normally, the Kalman filter tells you how to compute the conditional mean based on the data you have at a particular moment in time.</p> <p>I'm not familiar with the book, but I assume that you mean what the <a href="http://en.wikipedia.org/wiki/Kalman_filter" rel="nofollow">Wikipedia page</a> calls the predicted state estimate. </p> <p>You don't say anything about measurement error. Do you observe $x_t$ exactly? By assumption, since you choose $u_t$ you know it at time $t-1$. Then the formula is just telling you that $$E(x_t | u_t, x_{t-1}) = A E(x_{t-1} | u_t, x_{t-1}) + B E(u_t | u_t, x_{t-1}) + E(\epsilon_t | u_t, x_{t-1}).$$ Since $E(x_{t-1} | u_t, x_{t-1}) = x_{t-1}$ and $E(u_t | u_t, x_{t-1}) = u_t$, and the noise is independent, then $$E(x_t | u_t, x_{t-1}) = A x_{t-1} + B u_t.$$</p> <p>If you don't observe $x_t$ exactly, then you observe it with some error, given by $$z_t = H_t x_t + \nu_t,$$ where $z_t$ is your observation at time $t$ and $\nu_t$ is again Gaussian white noise, independent of everything else.</p> <p>Now, at time $t-1$ you only know $z_1, \ldots, z_{t-1}$, so the best you can do is $$E(x_t | u_t, z_1, \ldots, z_{t-1}),$$ which I'll write as $$E_{t-1} (x_t),$$ since it's the conditional mean given all information at time $t-1$ (including $u_t$, which you choose at time $t-1$.</p> <p>Using the definition, $$E_{t-1}(x_t) = A E_{t-1}(x_{t-1}) + B E_{t-1}(u_t) + E_{t-1}(\epsilon_t),$$ but the most this simplifies is to $$E_{t-1}(x_t) = A E_{t-1}(x_{t-1}) + B u_t.$$ With measurement error, the Kalman filter by design just works by calculating the two conditional means $E_{t-1}(x_t)$ and $E_{t-1}(x_{t-1})$, and no other conditional or unconditional means.</p>