kalman-filter.tex 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. \documentclass[varwidth=true, border=2pt]{standalone}
  2. \usepackage{pgfplots}
  3. \usepackage{tikz}
  4. \usetikzlibrary{shapes,arrows,arrows.meta}
  5. \pgfplotsset{compat=1.13}
  6. \usepackage{mathtools}
  7. \usepackage{amssymb}
  8. \begin{document}
  9. \tikzstyle{block} = [draw, rectangle, minimum width=6em, align=center,fill=gray!5]
  10. \tikzstyle{arrow} = [-latex, very thick]
  11. \newcommand*{\tran}{\top}
  12. \begin{tikzpicture}[auto, node distance=2cm,>=latex']
  13. \setlength{\abovedisplayskip}{0pt}
  14. % Place the blocks
  15. \node[text width=1cm,
  16. rounded corners=3pt,
  17. block,
  18. label={[above,align=center]{Initial\\State}}] at (-1, 0) (initial)
  19. {$$\mathbf{x}_0$$ $$P_0$$};
  20. \node at (0.25, 0.1) (sum) {};
  21. \node[block, text width=6cm,
  22. label={[above,align=center]{Prediction}}] at (4, 0) (prediction)
  23. {\begin{align*}
  24. \mathbf{x}_{k+1}^{(P)} &= A \mathbf{x}_k + B {\color{orange} a_k}\\
  25. P_{k+1}^{(P)} &= A P_k A^\tran + C_k^{(r_s)}
  26. \end{align*}};
  27. \node [block, right of=prediction,
  28. node distance=3cm, text width=1.4cm] at (6, -2) (iterUpdate)
  29. {$$k \leftarrow k + 1$$};
  30. \node [block, text width=6cm,
  31. label={[above,align=center]{Innovation}}] at (4, -4) (innovation)
  32. {\begin{align*}
  33. K_k &= P_k^{(P)} H^\tran {\left (H P_k^{(P)} H^\tran + C_k^{(r_m)} \right)}^{-1}\\
  34. {\color{blue} \mathbf{x}_k} &= (I - K_k H) \mathbf{x}_k^{(P)} + K_k {\color{orange} z_k}\\
  35. {\color{blue} P_k} &= (I - K_k H) P_k^{(P)}
  36. \end{align*}};
  37. % Connect the nodes
  38. \draw [arrow] (initial) -- (prediction);
  39. \draw [arrow] (prediction.east) -| (iterUpdate.north);
  40. \draw [arrow] (iterUpdate) |- (innovation);
  41. \draw [arrow] (innovation.west) -| (sum);
  42. \end{tikzpicture}
  43. \end{document}