Changes for latex rendering in Github.

Github cannot handle certain formatting of latex, so fixing
it.
This commit is contained in:
Roger Labbe 2015-05-09 14:45:06 -07:00
parent f4909701f8
commit 65b4b59ba3
12 changed files with 12587 additions and 12286 deletions

View File

@ -11,7 +11,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# The g-h Filter (alpha-beta filter)"
"# The g-h Filter"
]
},
{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -284,11 +284,11 @@
"which is a second order differential equation. It is not possible to write a linear equation for this equation, and therefore we cannot even formulate a design for the Kalman filter. \n",
"\n",
"The early adopters of Kalman filters needed to apply the filters to nonlinear problems and this fact was not lost on them. For example, radar is inherently nonlinear. Radars measure the slant range to an object, and we are typically interested in the aircraft's position over the ground. We invoke Pythagoras and get the nonlinear equation:\n",
"\n",
"$$x=\\sqrt{slant^2 - altitude^2}$$\n",
"\n",
"And then, of course, the behavior of the objects being tracked is also nonlinear. So shortly after the idea of the Kalman filter was published by Kalman people began working on how to extend the Kalman filter into nonlinear problems. \n",
"\n",
"\n",
"It is almost true to state that the only equation you know how to solve is $\\mathbf{Ax}=\\mathbf{b}$. I don't mean you the reader, but the entire mathematical community. We only really know how to do linear algebra. I can give you a linear equation and you can solve it. If I told you your job depended on knowing how to solve the equation $2x+3=4$ you would trivially solve it. If I then told you I needed to know the answer to $2x-3=8$ you would not break out into a sweat because we know all the rules for solving linear equations. I could write a program to randomly generate linear equations and you would be able to solve every one.\n",
"\n",
"Any of us with a formal mathematical education spent years learning various analytic ways to solve integrals, differential equations and so on. It was all a lie, nearly. Even trivial physical systems produce equations that no one in the world know how to solve analytically. I can give you an equation that you are able to integrate, multiply or add in an $ln$ term, and render it insolvable. \n",
@ -314,10 +314,12 @@
"metadata": {},
"source": [
"As asserted in the introduction the only math you really know how to do is linear math. Equations of the form \n",
"\n",
"$$ A\\mathbf{x}=\\mathbf{b}$$.\n",
"\n",
"That may strike you as hyperbole. After all, in this book we have integrated a polynomial to get distance from velocity and time:\n",
" We know how to integrate a polynomial, for example, and so we are able to find the closed form equation for distance given velocity and time:\n",
"\n",
"$$\\int{(vt+v_0)}\\,dt = \\frac{a}{2}t^2+v_0t+d_0$$\n",
"\n",
"That's nonlinear. But it is also a very special form. You spent a lot of time, probably at least a year, learning how to integrate various terms, and you still can not integrate some arbitrary equation - no one can. We don't know how. If you took freshman Physics you perhaps remember homework involving sliding frictionless blocks on a plane and other toy problems. At the end of the course you were almost entirely unequipped to solve real world problems because the real world is nonlinear, and you were taught linear, closed forms of equations. It made the math tractable, but mostly useless. \n",
@ -335,8 +337,9 @@
"$$\n",
"\n",
">which is clearly nonsense. Hence, an apparently linear equation such as\n",
">\n",
"$$L(f(t)) = f(t) + 1$$\n",
"\n",
">\n",
">is not linear because $L(0) = 1$! Be careful!"
]
},
@ -526,6 +529,7 @@
"metadata": {},
"source": [
"This result may be somewhat surprising to you. The transfer function looks \"fairly\" linear - it is pretty close to a straight line, but the probability distribution of the output is completely different from a Gaussian. Recall the equations for multiplying two univariate Gaussians:\n",
"\n",
"$$\\begin{aligned}\n",
"\\mu =\\frac{\\sigma_1^2 \\mu_2 + \\sigma_2^2 \\mu_1} {\\sigma_1^2 + \\sigma_2^2}\\mbox{, } \n",
"\\sigma = \\frac{1}{\\frac{1}{\\sigma_1^2} + \\frac{1}{\\sigma_2^2}}\n",
@ -594,6 +598,7 @@
"metadata": {},
"source": [
"Let's compare that to the linear function that passes through (-2,3) and (2,-3), which is very close to the nonlinear function we have plotted. Using the equation of a line we have\n",
"\n",
"$$m=\\frac{-3-3}{2-(-2)}=-1.5$$"
]
},

View File

@ -379,7 +379,9 @@
"$$\\begin{aligned}x&=x+y\\\\\n",
"y &= 0.1x^2 + y^2\\end{aligned}$$ \n",
"\n",
"for the mean and covariance $$\\mu = \\begin{bmatrix}0\\\\0\\end{bmatrix}, \n",
"for the mean and covariance \n",
"\n",
"$$\\mu = \\begin{bmatrix}0\\\\0\\end{bmatrix}, \n",
"\\Sigma=\\begin{bmatrix}32&15\\\\15&40\\end{bmatrix}$$"
]
},
@ -658,14 +660,15 @@
"$$ \\mathcal{X}_0 = \\mu$$\n",
"\n",
"The corresponding weight for this sigma point is\n",
"\n",
"$$\n",
"W_0 = \\frac{\\kappa}{n+\\kappa}\n",
"$$\n",
"\n",
"where $n$ is the dimension of the problem, and $\\kappa$ is a scaling factor that will be discussed in a moment.\n",
"\n",
"The rest of the sigma points are defined to be\n",
"\n",
"\n",
"$$ \n",
"\\begin{aligned}\n",
"\\mathcal{X}_i &= \\mu + (\\sqrt{(n+\\kappa)\\Sigma})_i\\,\\,\\,\\, &\\text{for}\\text{ i=1 .. n} \\\\\n",
@ -753,6 +756,7 @@
"$$\n",
"\n",
"This computes the mean and covariance represented by the green ellipse above, and corresponds with the linear Kalman filter equations of\n",
"\n",
"$$ \\begin{aligned}\n",
"\\mathbf{x}^- &= \\mathbf{Fx}\\\\\n",
"\\mathbf{P}^- &= \\mathbf{FPF}^T+\\mathbf{Q}\n",
@ -820,6 +824,7 @@
"$$\\mathbf{P}_{xz} =\\sum W(\\mathcal{X}-x)(\\mathcal{X_z}-\\mathbf{x}_z)^\\mathsf{T}$$\n",
"\n",
"And then the Kalman gain is defined as\n",
"\n",
"$$K = \\mathbf{P}_{xz} \\mathbf{P}_z^{-1}$$\n",
"\n",
"Finally, we compute the new state estimate using the residual and Kalman gain:\n",
@ -1453,10 +1458,10 @@
"\n",
"This requires the following change to the state transition function, which is still linear.\n",
"\n",
"\n",
"$$\\mathbf{x}^- = \\begin{bmatrix} 1 & \\Delta t & 0 &0 \\\\ 0& 1& 0 &0\\\\ 0&0&1&dt \\\\ 0&0&0&1\\end{bmatrix}\n",
"\\begin{bmatrix}x \\\\\\dot{x}\\\\ z\\\\ \\dot{z}\\end{bmatrix} \n",
"$$\n",
"\n",
"The measurement function stays the same, but we will have to alter Q to account for the state dimensionality change."
]
},
@ -2699,7 +2704,6 @@
"\\end{aligned}\n",
"$$\n",
"\n",
"\n",
"The Python for this is not much more difficult once we wrap our heads around the $[\\sqrt{(n+\\kappa)\\Sigma}]_i$ term.\n",
"\n",
"The term $[\\sqrt{(n+\\kappa)\\Sigma}]_i$ has to be a matrix because $\\Sigma$ is a matrix. The subscript $i$ is choosing the column vector of the matrix. What is the 'square root of a matrix'? The usual definition is that the square root of a matrix $\\Sigma$ is just the matrix $S$ that, when multiplied by itself, yields $\\Sigma$.\n",
@ -2738,6 +2742,7 @@
"metadata": {},
"source": [
"Now let's implement the unscented transform. Recall the equations\n",
"\n",
"$$\\begin{aligned}\n",
"\\mu &= \\sum_i w_i\\mathcal{X}_i\\;\\;\\;&(2) \\\\\n",
"\\Sigma &= \\sum_i w_i{(\\mathcal{X}_i-\\mu)(\\mathcal{X}_i-\\mu)^\\mathsf{T}}\\;\\;\\;&(3)\n",
@ -2929,10 +2934,8 @@
"\n",
"The mean an covariance of those points is computed with the unscented transform. The residual and Kalman gain is then computed. The cross variance is computed as:\n",
"\n",
"\n",
"$$\\mathbf{P}_{xz} =\\sum W(\\mathcal{X}-x)(\\mathcal{X_z}-\\mathbf{x}_z)^\\mathsf{T}$$\n",
"\n",
"\n",
"Finally, we compute the new state estimate using the residual and Kalman gain:\n",
"\n",
"$$\\hat{\\mathbf{x}} = \\mathbf{x}^- + \\mathbf{Ky}$$\n",

File diff suppressed because one or more lines are too long

View File

@ -461,6 +461,7 @@
"$$\n",
"\n",
"Which we compute as\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"\\frac{\\partial h_1}{\\partial x} &= ((x-x_A)^2 + (y-y_A)^2))^\\frac{1}{2} \\\\\n",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long