From 41d8d246e029adf24ed23f9185276f15b2d22e33 Mon Sep 17 00:00:00 2001 From: Roger Labbe Date: Wed, 9 Dec 2015 06:31:14 -0800 Subject: [PATCH] Extensive copy editing. --- 07-Kalman-Filter-Math.ipynb | 12 +- 09-Nonlinear-Filtering.ipynb | 185 ++++---- 10-Unscented-Kalman-Filter.ipynb | 545 ++++++++++++---------- 11-Extended-Kalman-Filters.ipynb | 744 +++++++++++++++---------------- code/ekf_internal.py | 12 +- code/nonlinear_plots.py | 25 +- code/pf_internal.py | 1 + code/ukf_internal.py | 11 + 8 files changed, 795 insertions(+), 740 deletions(-) diff --git a/07-Kalman-Filter-Math.ipynb b/07-Kalman-Filter-Math.ipynb index 2c13d2e..6de9636 100644 --- a/07-Kalman-Filter-Math.ipynb +++ b/07-Kalman-Filter-Math.ipynb @@ -349,7 +349,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## State Space Representations of Dynamic Systems" + "## State-Space Representations of Dynamic Systems" ] }, { @@ -358,7 +358,7 @@ "source": [ "The equation $\\mathbf{v} = \\frac{d \\mathbf{x}}{d t}$ is the simplest possible differential equation. We trivially integrate it into the high school physics equation $x = vt + x_0$. Almost all other differential equations encountered in physical systems will not yield to this approach. \n", "\n", - "*State space* methods became popular around the time of the Apollo missions, in no small part due to the work of Dr. Kalman. The idea is simple. First, we convert a system of $n^{th}$-order differential equations into an equivalent set of first-order differential systems. We can then represent that set of first order equations as in vector matrix form. Once in this form we use the formidable powers of linear algebra to solve the system of equations. The Kalman filter is an example of this power. " + "*State-space* methods became popular around the time of the Apollo missions, in no small part due to the work of Dr. Kalman. The idea is simple. First, we convert a system of $n^{th}$-order differential equations into an equivalent set of first-order differential systems. We can then represent that set of first order equations as in vector matrix form. Once in this form we use the formidable powers of linear algebra to solve the system of equations. The Kalman filter is an example of this power. " ] }, { @@ -449,7 +449,7 @@ "\n", "In other words, we need to find the inverse of $F$. This is not at all trivial, and a significant amount of coursework in a STEM education is devoted to finding tricky, analytic solutions to this problem. \n", "\n", - "In the end, however, they are tricks, and many simple forms of $f(x)$ either have no closed form solution or pose extreme difficulties. Instead, the practicing engineer turns to state space methods to find solutions." + "In the end, however, they are tricks, and many simple forms of $f(x)$ either have no closed form solution or pose extreme difficulties. Instead, the practicing engineer turns to state-space methods to find solutions." ] }, { @@ -458,7 +458,7 @@ "source": [ "### Forming First Order Equations from Higher Order Equations\n", "\n", - "Models of physical systems often require second or higher order equations. However, state space methods require first-order differential equations, which are equations with only first derivatives. Any higher order system of equations can be converted to a first order set of equations by defining extra variables for the first order terms and then solving. \n", + "Models of physical systems often require second or higher order equations. However, state-space methods require first-order differential equations, which are equations with only first derivatives. Any higher order system of equations can be converted to a first order set of equations by defining extra variables for the first order terms and then solving. \n", "\n", "Let's do an example. Given the system $\\ddot{x} - 6\\dot{x} + 9x = t$ find the first order equations.\n", "\n", @@ -589,7 +589,7 @@ "\n", "$$ v = \\dot{x}\\\\a=\\ddot{x} =0,$$\n", "\n", - "which we can put in state space matrix form as\n", + "which we can put in state-space matrix form as\n", "\n", "$$\\begin{bmatrix}\\dot{x} \\\\ \\ddot{x}\\end{bmatrix} =\\begin{bmatrix}0&1\\\\0&0\\end{bmatrix} \\begin{bmatrix}x \\\\ \\dot{x}\\end{bmatrix}$$\n", "\n", @@ -619,7 +619,7 @@ "This should look very familiar to you! This is the equation we used in the **Multivariate Kalman Filter** chapter to track a moving object.\n", "\n", "$$\n", - "{\\begin{bmatrix}x\\\\\\dot{x}\\end{bmatrix}}^- =\\begin{bmatrix}1&t \\\\ 0&1\\end{bmatrix} \\begin{bmatrix}x \\\\ \\dot{x}\\end{bmatrix}\n", + "{\\begin{bmatrix}x\\\\\\dot{x}\\end{bmatrix}}^- =\\begin{bmatrix}1&\\Delta t \\\\ 0&1\\end{bmatrix} \\begin{bmatrix}x \\\\ \\dot{x}\\end{bmatrix}\n", "$$\n", "\n", "We derived this equation in that chapter by using techniques that are much easier to understand. The advantage of the Taylor series expansion is that we can use it for any arbitrary set of differential equations which are time invariant. \n", diff --git a/09-Nonlinear-Filtering.ipynb b/09-Nonlinear-Filtering.ipynb index e915b40..26958db 100644 --- a/09-Nonlinear-Filtering.ipynb +++ b/09-Nonlinear-Filtering.ipynb @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 14, "metadata": { "collapsed": false }, @@ -30,6 +30,9 @@ "@import url('http://fonts.googleapis.com/css?family=Arimo');\n", "@import url('http://fonts.googleapis.com/css?family=Fira_sans');\n", "\n", + ".CodeMirror pre {\n", + " font-family: 'Source Code Pro', Consolas, monocco, monospace;\n", + "}\n", " div.cell{\n", " width: 900px;\n", " margin-left: 0% !important;\n", @@ -49,7 +52,7 @@ "\t\n", " div.input_area {\n", " background: #F6F6F9;\n", - " border: 1px solid #586e75;\n", + " border: 1px solid #586e75; \n", " }\n", "\n", " .text_cell_render h1 {\n", @@ -108,6 +111,7 @@ " h5 {\n", " font-family: 'Open sans',verdana,arial,sans-serif;\n", " }\n", + "\n", " .text_cell_render h5 {\n", " font-weight: 200;\n", " font-style: normal;\n", @@ -142,7 +146,8 @@ "}\n", "\n", " code{\n", - " font-size: 70%;\n", + " font-size: 6pt;\n", + "\n", " }\n", " .rendered_html code{\n", " background-color: transparent;\n", @@ -235,7 +240,8 @@ "