Restructuring for print.
I have moved less pertinent material to appendixes. The idea is that a print edition should contain only the most important material, and online appendixes allow the reader to access supplemental material.
This commit is contained in:
parent
a0b7a50b05
commit
6d9c500e50
@ -2989,549 +2989,6 @@
|
||||
" self.P = self.Pp - dot3(K, Pz, K.T)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Full Source from FilterPy"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Without further explanation, here is the full source from FilterPy.\n",
|
||||
"\n",
|
||||
"** author's note ** this is somewhat dated, but while authorship of the book is in progress I am not going to update this section every time I make a minor change to the filterpy code."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 44,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"scrolled": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# -*- coding: utf-8 -*-\n",
|
||||
"\"\"\"Copyright 2014 Roger R Labbe Jr.\n",
|
||||
"\n",
|
||||
"filterpy library.\n",
|
||||
"http://github.com/rlabbe/filterpy\n",
|
||||
"\n",
|
||||
"Documentation at:\n",
|
||||
"https://filterpy.readthedocs.org\n",
|
||||
"\n",
|
||||
"Supporting book at:\n",
|
||||
"https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python\n",
|
||||
"\n",
|
||||
"This is licensed under an MIT license. See the readme.MD file\n",
|
||||
"for more information.\n",
|
||||
"\"\"\"\n",
|
||||
"\n",
|
||||
"# pylint bug - warns about numpy functions which do in fact exist.\n",
|
||||
"# pylint: disable=E1101\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"#I like aligning equal signs for readability of math\n",
|
||||
"# pylint: disable=C0326\n",
|
||||
"\n",
|
||||
"from __future__ import (absolute_import, division, print_function,\n",
|
||||
" unicode_literals)\n",
|
||||
"\n",
|
||||
"from numpy.linalg import inv, cholesky\n",
|
||||
"import numpy as np\n",
|
||||
"from numpy import asarray, eye, zeros, dot, isscalar, outer\n",
|
||||
"from filterpy.common import dot3\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class UnscentedKalmanFilter(object):\n",
|
||||
" # pylint: disable=too-many-instance-attributes\n",
|
||||
" # pylint: disable=C0103\n",
|
||||
" \"\"\" Implements the Unscented Kalman filter (UKF) as defined by Simon J.\n",
|
||||
" Julier and Jeffery K. Uhlmann [1]. Succintly, the UKF selects a set of\n",
|
||||
" sigma points and weights inside the covariance matrix of the filter's\n",
|
||||
" state. These points are transformed through the nonlinear process being\n",
|
||||
" filtered, and are rebuilt into a mean and covariance by computed the\n",
|
||||
" weighted mean and expected value of the transformed points. Read the paper;\n",
|
||||
" it is excellent. My book \"Kalman and Bayesian Filters in Python\" [2]\n",
|
||||
" explains the algorithm, develops this code, and provides examples of the\n",
|
||||
" filter in use.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" You will have to set the following attributes after constructing this\n",
|
||||
" object for the filter to perform properly.\n",
|
||||
"\n",
|
||||
" **Attributes**\n",
|
||||
"\n",
|
||||
" x : numpy.array(dim_x)\n",
|
||||
" state estimate vector\n",
|
||||
"\n",
|
||||
" P : numpy.array(dim_x, dim_x)\n",
|
||||
" covariance estimate matrix\n",
|
||||
"\n",
|
||||
" R : numpy.array(dim_z, dim_z)\n",
|
||||
" measurement noise matrix\n",
|
||||
"\n",
|
||||
" Q : numpy.array(dim_x, dim_x)\n",
|
||||
" process noise matrix\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" You may read the following attributes.\n",
|
||||
"\n",
|
||||
" **Readable Attributes**\n",
|
||||
"\n",
|
||||
" Pxz : numpy.aray(dim_x, dim_z)\n",
|
||||
" Cross variance of x and z computed during update() call.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" **References**\n",
|
||||
"\n",
|
||||
" .. [1] Julier, Simon J.; Uhlmann, Jeffrey \"A New Extension of the Kalman\n",
|
||||
" Filter to Nonlinear Systems\". Proc. SPIE 3068, Signal Processing,\n",
|
||||
" Sensor Fusion, and Target Recognition VI, 182 (July 28, 1997)\n",
|
||||
"\n",
|
||||
" .. [2] Labbe, Roger R. \"Kalman and Bayesian Filters in Python\"\n",
|
||||
"\n",
|
||||
" https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" def __init__(self, dim_x, dim_z, dt, hx, fx, kappa=0.):\n",
|
||||
" \"\"\" Create a Kalman filter. You are responsible for setting the\n",
|
||||
" various state variables to reasonable values; the defaults below will\n",
|
||||
" not give you a functional filter.\n",
|
||||
"\n",
|
||||
" **Parameters**\n",
|
||||
"\n",
|
||||
" dim_x : int\n",
|
||||
" Number of state variables for the filter. For example, if\n",
|
||||
" you are tracking the position and velocity of an object in two\n",
|
||||
" dimensions, dim_x would be 4.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" dim_z : int\n",
|
||||
" Number of of measurement inputs. For example, if the sensor\n",
|
||||
" provides you with position in (x,y), dim_z would be 2.\n",
|
||||
"\n",
|
||||
" dt : float\n",
|
||||
" Time between steps in seconds.\n",
|
||||
"\n",
|
||||
" hx : function(x)\n",
|
||||
" Measurement function. Converts state vector x into a measurement\n",
|
||||
" vector of shape (dim_z).\n",
|
||||
"\n",
|
||||
" fx : function(x,dt)\n",
|
||||
" function that returns the state x transformed by the\n",
|
||||
" state transistion function. dt is the time step in seconds.\n",
|
||||
"\n",
|
||||
" kappa : float, default=0.\n",
|
||||
" Scaling factor that can reduce high order errors. kappa=0 gives\n",
|
||||
" the standard unscented filter. According to [1], if you set\n",
|
||||
" kappa to 3-dim_x for a Gaussian x you will minimize the fourth\n",
|
||||
" order errors in x and P.\n",
|
||||
"\n",
|
||||
" **References**\n",
|
||||
"\n",
|
||||
" [1] S. Julier, J. Uhlmann, and H. Durrant-Whyte. \"A new method for\n",
|
||||
" the nonlinear transformation of means and covariances in filters\n",
|
||||
" and estimators,\" IEEE Transactions on Automatic Control, 45(3),\n",
|
||||
" pp. 477-482 (March 2000).\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" self.Q = eye(dim_x)\n",
|
||||
" self.R = eye(dim_z)\n",
|
||||
" self.x = zeros(dim_x)\n",
|
||||
" self.P = eye(dim_x)\n",
|
||||
" self._dim_x = dim_x\n",
|
||||
" self._dim_z = dim_z\n",
|
||||
" self._dt = dt\n",
|
||||
" self._num_sigmas = 2*dim_x + 1\n",
|
||||
" self.kappa = kappa\n",
|
||||
" self.hx = hx\n",
|
||||
" self.fx = fx\n",
|
||||
"\n",
|
||||
" # weights for the sigma points\n",
|
||||
" self.W = self.weights(dim_x, kappa)\n",
|
||||
"\n",
|
||||
" # sigma points transformed through f(x) and h(x)\n",
|
||||
" # variables for efficiency so we don't recreate every update\n",
|
||||
" self.sigmas_f = zeros((self._num_sigmas, self._dim_x))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" def update(self, z, R=None, residual=np.subtract, UT=None):\n",
|
||||
" \"\"\" Update the UKF with the given measurements. On return,\n",
|
||||
" self.x and self.P contain the new mean and covariance of the filter.\n",
|
||||
"\n",
|
||||
" **Parameters**\n",
|
||||
"\n",
|
||||
" z : numpy.array of shape (dim_z)\n",
|
||||
" measurement vector\n",
|
||||
"\n",
|
||||
" R : numpy.array((dim_z, dim_z)), optional\n",
|
||||
" Measurement noise. If provided, overrides self.R for\n",
|
||||
" this function call.\n",
|
||||
"\n",
|
||||
" residual : function (z, z2), optional\n",
|
||||
" Optional function that computes the residual (difference) between\n",
|
||||
" the two measurement vectors. If you do not provide this, then the\n",
|
||||
" built in minus operator will be used. You will normally want to use\n",
|
||||
" the built in unless your residual computation is nonlinear (for\n",
|
||||
" example, if they are angles)\n",
|
||||
"\n",
|
||||
" UT : function(sigmas, Wm, Wc, noise_cov), optional\n",
|
||||
" Optional function to compute the unscented transform for the sigma\n",
|
||||
" points passed through hx. Typically the default function will\n",
|
||||
" work, but if for example you are using angles the default method\n",
|
||||
" of computing means and residuals will not work, and you will have\n",
|
||||
" to define how to compute it.\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" if isscalar(z):\n",
|
||||
" dim_z = 1\n",
|
||||
" else:\n",
|
||||
" dim_z = len(z)\n",
|
||||
"\n",
|
||||
" if R is None:\n",
|
||||
" R = self.R\n",
|
||||
" elif np.isscalar(R):\n",
|
||||
" R = eye(self._dim_z) * R\n",
|
||||
"\n",
|
||||
" # rename for readability\n",
|
||||
" sigmas_f = self.sigmas_f\n",
|
||||
" sigmas_h = zeros((self._num_sigmas, dim_z))\n",
|
||||
"\n",
|
||||
" if UT is None:\n",
|
||||
" UT = unscented_transform\n",
|
||||
"\n",
|
||||
" # transform sigma points into measurement space\n",
|
||||
" for i in range(self._num_sigmas):\n",
|
||||
" sigmas_h[i] = self.hx(sigmas_f[i])\n",
|
||||
"\n",
|
||||
" # mean and covariance of prediction passed through inscented transform\n",
|
||||
" zp, Pz = UT(sigmas_h, self.W, self.W, R)\n",
|
||||
"\n",
|
||||
" # compute cross variance of the state and the measurements\n",
|
||||
" '''self.Pxz = zeros((self._dim_x, dim_z))\n",
|
||||
" for i in range(self._num_sigmas):\n",
|
||||
" self.Pxz += self.W[i] * np.outer(sigmas_f[i] - self.x,\n",
|
||||
" residual(sigmas_h[i], zp))'''\n",
|
||||
"\n",
|
||||
" # this is the unreadable but fast implementation of the\n",
|
||||
" # commented out loop above\n",
|
||||
" yh = sigmas_f - self.x[np.newaxis, :]\n",
|
||||
" yz = residual(sigmas_h, zp[np.newaxis, :])\n",
|
||||
" self.Pxz = yh.T.dot(np.diag(self.W)).dot(yz)\n",
|
||||
"\n",
|
||||
" K = dot(self.Pxz, inv(Pz)) # Kalman gain\n",
|
||||
" y = residual(z, zp)\n",
|
||||
"\n",
|
||||
" self.x = self.x + dot(K, y)\n",
|
||||
" self.P = self.P - dot3(K, Pz, K.T)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" def predict(self, dt=None):\n",
|
||||
" \"\"\" Performs the predict step of the UKF. On return, self.xp and\n",
|
||||
" self.Pp contain the predicted state (xp) and covariance (Pp). 'p'\n",
|
||||
" stands for prediction.\n",
|
||||
"\n",
|
||||
" **Parameters**\n",
|
||||
" dt : double, optional\n",
|
||||
" If specified, the time step to be used for this prediction.\n",
|
||||
" self._dt is used if this is not provided.\n",
|
||||
"\n",
|
||||
" Important: this MUST be called before update() is called for the\n",
|
||||
" first time.\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" if dt is None:\n",
|
||||
" dt = self._dt\n",
|
||||
"\n",
|
||||
" # calculate sigma points for given mean and covariance\n",
|
||||
" sigmas = self.sigma_points(self.x, self.P, self.kappa)\n",
|
||||
"\n",
|
||||
" for i in range(self._num_sigmas):\n",
|
||||
" self.sigmas_f[i] = self.fx(sigmas[i], dt)\n",
|
||||
"\n",
|
||||
" self.x, self.P = unscented_transform(\n",
|
||||
" self.sigmas_f, self.W, self.W, self.Q)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" def batch_filter(self, zs, Rs=None, residual=np.subtract, UT=None):\n",
|
||||
" \"\"\" Performs the UKF filter over the list of measurement in `zs`.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" **Parameters**\n",
|
||||
"\n",
|
||||
" zs : list-like\n",
|
||||
" list of measurements at each time step `self._dt` Missing\n",
|
||||
" measurements must be represented by 'None'.\n",
|
||||
"\n",
|
||||
" Rs : list-like, optional\n",
|
||||
" optional list of values to use for the measurement error\n",
|
||||
" covariance; a value of None in any position will cause the filter\n",
|
||||
" to use `self.R` for that time step.\n",
|
||||
"\n",
|
||||
" residual : function (z, z2), optional\n",
|
||||
" Optional function that computes the residual (difference) between\n",
|
||||
" the two measurement vectors. If you do not provide this, then the\n",
|
||||
" built in minus operator will be used. You will normally want to use\n",
|
||||
" the built in unless your residual computation is nonlinear (for\n",
|
||||
" example, if they are angles)\n",
|
||||
"\n",
|
||||
" UT : function(sigmas, Wm, Wc, noise_cov), optional\n",
|
||||
" Optional function to compute the unscented transform for the sigma\n",
|
||||
" points passed through hx. Typically the default function will\n",
|
||||
" work, but if for example you are using angles the default method\n",
|
||||
" of computing means and residuals will not work, and you will have\n",
|
||||
" to define how to compute it.\n",
|
||||
"\n",
|
||||
" **Returns**\n",
|
||||
"\n",
|
||||
" means: np.array((n,dim_x,1))\n",
|
||||
" array of the state for each time step after the update. Each entry\n",
|
||||
" is an np.array. In other words `means[k,:]` is the state at step\n",
|
||||
" `k`.\n",
|
||||
"\n",
|
||||
" covariance: np.array((n,dim_x,dim_x))\n",
|
||||
" array of the covariances for each time step after the update.\n",
|
||||
" In other words `covariance[k,:,:]` is the covariance at step `k`.\n",
|
||||
" \n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" try:\n",
|
||||
" z = zs[0]\n",
|
||||
" except:\n",
|
||||
" assert not isscalar(zs), 'zs must be list-like'\n",
|
||||
"\n",
|
||||
" if self._dim_z == 1:\n",
|
||||
" assert isscalar(z) or (z.ndim==1 and len(z) == 1), \\\n",
|
||||
" 'zs must be a list of scalars or 1D, 1 element arrays'\n",
|
||||
"\n",
|
||||
" else:\n",
|
||||
" assert len(z) == self._dim_z, 'each element in zs must be a' \\\n",
|
||||
" '1D array of length {}'.format(self._dim_z)\n",
|
||||
"\n",
|
||||
" n = np.size(zs,0)\n",
|
||||
" if Rs is None:\n",
|
||||
" Rs = [None]*n\n",
|
||||
"\n",
|
||||
" # mean estimates from Kalman Filter\n",
|
||||
" if self.x.ndim == 1:\n",
|
||||
" means = zeros((n, self._dim_x))\n",
|
||||
" else:\n",
|
||||
" means = zeros((n, self._dim_x, 1))\n",
|
||||
"\n",
|
||||
" # state covariances from Kalman Filter\n",
|
||||
" covariances = zeros((n, self._dim_x, self._dim_x))\n",
|
||||
" \n",
|
||||
" for i, (z, r) in enumerate(zip(zs, Rs)):\n",
|
||||
" self.predict()\n",
|
||||
" self.update(z, r)\n",
|
||||
" means[i,:] = self.x\n",
|
||||
" covariances[i,:,:] = self.P\n",
|
||||
" \n",
|
||||
" return (means, covariances)\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" def rts_smoother(self, Xs, Ps, Qs=None, dt=None):\n",
|
||||
" \"\"\" Runs the Rauch-Tung-Striebal Kalman smoother on a set of\n",
|
||||
" means and covariances computed by the UKF. The usual input\n",
|
||||
" would come from the output of `batch_filter()`.\n",
|
||||
"\n",
|
||||
" **Parameters**\n",
|
||||
"\n",
|
||||
" Xs : numpy.array\n",
|
||||
" array of the means (state variable x) of the output of a Kalman\n",
|
||||
" filter.\n",
|
||||
"\n",
|
||||
" Ps : numpy.array\n",
|
||||
" array of the covariances of the output of a kalman filter.\n",
|
||||
"\n",
|
||||
" Q : list-like collection of numpy.array, optional\n",
|
||||
" Process noise of the Kalman filter at each time step. Optional,\n",
|
||||
" if not provided the filter's self.Q will be used\n",
|
||||
"\n",
|
||||
" dt : optional, float or array-like of float\n",
|
||||
" If provided, specifies the time step of each step of the filter.\n",
|
||||
" If float, then the same time step is used for all steps. If\n",
|
||||
" an array, then each element k contains the time at step k.\n",
|
||||
" Units are seconds.\n",
|
||||
"\n",
|
||||
" **Returns**\n",
|
||||
"\n",
|
||||
" 'x' : numpy.ndarray\n",
|
||||
" smoothed means\n",
|
||||
"\n",
|
||||
" 'P' : numpy.ndarray\n",
|
||||
" smoothed state covariances\n",
|
||||
"\n",
|
||||
" 'K' : numpy.ndarray\n",
|
||||
" smoother gain at each step\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" **Example**::\n",
|
||||
"\n",
|
||||
" zs = [t + random.randn()*4 for t in range (40)]\n",
|
||||
"\n",
|
||||
" (mu, cov, _, _) = kalman.batch_filter(zs)\n",
|
||||
" (x, P, K) = rts_smoother(mu, cov, fk.F, fk.Q)\n",
|
||||
"\n",
|
||||
" \"\"\"\n",
|
||||
" assert len(Xs) == len(Ps)\n",
|
||||
" n, dim_x = Xs.shape\n",
|
||||
"\n",
|
||||
" if dt is None:\n",
|
||||
" dt = [self._dt] * n\n",
|
||||
" elif isscalar(dt):\n",
|
||||
" dt = [dt] * n\n",
|
||||
"\n",
|
||||
" if Qs is None:\n",
|
||||
" Qs = [self.Q] * n\n",
|
||||
"\n",
|
||||
" # smoother gain\n",
|
||||
" Ks = zeros((n,dim_x,dim_x))\n",
|
||||
"\n",
|
||||
" num_sigmas = 2*dim_x + 1\n",
|
||||
"\n",
|
||||
" xs, ps = Xs.copy(), Ps.copy()\n",
|
||||
" sigmas_f = zeros((num_sigmas, dim_x))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" for k in range(n-2,-1,-1):\n",
|
||||
" # create sigma points from state estimate, pass through state func\n",
|
||||
" sigmas = self.sigma_points(xs[k], ps[k], self.kappa)\n",
|
||||
" for i in range(num_sigmas):\n",
|
||||
" sigmas_f[i] = self.fx(sigmas[i], dt[k])\n",
|
||||
"\n",
|
||||
" # compute backwards prior state and covariance\n",
|
||||
" xb = dot(self.W, sigmas_f)\n",
|
||||
" Pb = 0\n",
|
||||
" x = Xs[k]\n",
|
||||
" for i in range(num_sigmas):\n",
|
||||
" y = sigmas_f[i] - x\n",
|
||||
" Pb += self.W[i] * outer(y, y)\n",
|
||||
" Pb += Qs[k]\n",
|
||||
"\n",
|
||||
" # compute cross variance\n",
|
||||
" Pxb = 0\n",
|
||||
" for i in range(num_sigmas):\n",
|
||||
" z = sigmas[i] - Xs[k]\n",
|
||||
" y = sigmas_f[i] - xb\n",
|
||||
" Pxb += self.W[i] * outer(z, y)\n",
|
||||
"\n",
|
||||
" # compute gain\n",
|
||||
" K = dot(Pxb, inv(Pb))\n",
|
||||
"\n",
|
||||
" # update the smoothed estimates\n",
|
||||
" xs[k] += dot (K, xs[k+1] - xb)\n",
|
||||
" ps[k] += dot3(K, ps[k+1] - Pb, K.T)\n",
|
||||
" Ks[k] = K\n",
|
||||
"\n",
|
||||
" return (xs, ps, Ks)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" @staticmethod\n",
|
||||
" def weights(n, kappa):\n",
|
||||
" \"\"\" Computes the weights for an unscented Kalman filter. See\n",
|
||||
" __init__() for meaning of parameters.\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" assert kappa >= 0.0, \\\n",
|
||||
" \"kappa cannot be negative, it's value is {}\".format(kappa)\n",
|
||||
" assert n > 0, \"n must be greater than 0, it's value is {}\".format(n)\n",
|
||||
"\n",
|
||||
" k = .5 / (n+kappa)\n",
|
||||
" W = np.full(2*n+1, k)\n",
|
||||
" W[0] = kappa / (n+kappa)\n",
|
||||
" return W\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" @staticmethod\n",
|
||||
" def sigma_points(x, P, kappa):\n",
|
||||
" \"\"\" Computes the sigma points for an unscented Kalman filter\n",
|
||||
" given the mean (x) and covariance(P) of the filter.\n",
|
||||
" kappa is an arbitrary constant. Returns sigma points.\n",
|
||||
"\n",
|
||||
" Works with both scalar and array inputs:\n",
|
||||
" sigma_points (5, 9, 2) # mean 5, covariance 9\n",
|
||||
" sigma_points ([5, 2], 9*eye(2), 2) # means 5 and 2, covariance 9I\n",
|
||||
"\n",
|
||||
" **Parameters**\n",
|
||||
"\n",
|
||||
" X An array-like object of the means of length n\n",
|
||||
" Can be a scalar if 1D.\n",
|
||||
" examples: 1, [1,2], np.array([1,2])\n",
|
||||
"\n",
|
||||
" P : scalar, or np.array\n",
|
||||
" Covariance of the filter. If scalar, is treated as eye(n)*P.\n",
|
||||
"\n",
|
||||
" kappa : float\n",
|
||||
" Scaling factor.\n",
|
||||
"\n",
|
||||
" **Returns**\n",
|
||||
"\n",
|
||||
" sigmas : np.array, of size (n, 2n+1)\n",
|
||||
" 2D array of sigma points. Each column contains all of\n",
|
||||
" the sigmas for one dimension in the problem space. They\n",
|
||||
" are ordered as:\n",
|
||||
"\n",
|
||||
" .. math::\n",
|
||||
" sigmas[0] = x \\n\n",
|
||||
" sigmas[1..n] = x + [\\sqrt{(n+\\kappa)P}]_k \\n\n",
|
||||
" sigmas[n+1..2n] = x - [\\sqrt{(n+\\kappa)P}]_k\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" if np.isscalar(x):\n",
|
||||
" x = asarray([x])\n",
|
||||
" n = np.size(x) # dimension of problem\n",
|
||||
"\n",
|
||||
" if np.isscalar(P):\n",
|
||||
" P = eye(n)*P\n",
|
||||
"\n",
|
||||
" sigmas = zeros((2*n+1, n))\n",
|
||||
"\n",
|
||||
" # implements U'*U = (n+kappa)*P. Returns lower triangular matrix.\n",
|
||||
" # Take transpose so we can access with U[i]\n",
|
||||
" U = cholesky((n+kappa)*P).T\n",
|
||||
" #U = sqrtm((n+kappa)*P).T\n",
|
||||
"\n",
|
||||
" sigmas[0] = x\n",
|
||||
" sigmas[1:n+1] = x + U\n",
|
||||
" sigmas[n+1:2*n+2] = x - U\n",
|
||||
"\n",
|
||||
" return sigmas\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def unscented_transform(Sigmas, Wm, Wc, noise_cov):\n",
|
||||
" \"\"\" Computes unscented transform of a set of sigma points and weights.\n",
|
||||
" returns the mean and covariance in a tuple.\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" kmax, n = Sigmas.shape\n",
|
||||
"\n",
|
||||
" # new mean is just the sum of the sigmas * weight\n",
|
||||
" x = dot(Wm, Sigmas) # dot = \\Sigma^n_1 (W[k]*Xi[k])\n",
|
||||
"\n",
|
||||
" # new covariance is the sum of the outer product of the residuals\n",
|
||||
" # times the weights\n",
|
||||
" '''P = zeros((n, n))\n",
|
||||
" for k in range(kmax):\n",
|
||||
" y = Sigmas[k] - x\n",
|
||||
" P += Wc[k] * np.outer(y, y)'''\n",
|
||||
"\n",
|
||||
" # this is the fast way to do the commented out code above\n",
|
||||
" y = Sigmas - x[np.newaxis,:]\n",
|
||||
" P = y.T.dot(np.diag(Wc)).dot(y)\n",
|
||||
"\n",
|
||||
" if noise_cov is not None:\n",
|
||||
" P += noise_cov\n",
|
||||
"\n",
|
||||
" return (x, P)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
@ -1,427 +1,427 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<style>\n",
|
||||
"@import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n",
|
||||
"@import url('http://fonts.googleapis.com/css?family=Vollkorn');\n",
|
||||
"@import url('http://fonts.googleapis.com/css?family=Arimo');\n",
|
||||
"\n",
|
||||
" div.cell{\n",
|
||||
" width: 850px;\n",
|
||||
" margin-left: 0% !important;\n",
|
||||
" margin-right: auto;\n",
|
||||
" }\n",
|
||||
" div.text_cell code {\n",
|
||||
" background: transparent;\n",
|
||||
" color: #000000;\n",
|
||||
" font-weight: 600;\n",
|
||||
" font-size: 11pt;\n",
|
||||
" font-style: bold;\n",
|
||||
" font-family: 'Source Code Pro', Consolas, monocco, monospace;\n",
|
||||
" }\n",
|
||||
" h1 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
"\t}\n",
|
||||
"\t\n",
|
||||
" div.input_area {\n",
|
||||
" background: #F6F6F9;\n",
|
||||
" border: 1px solid #586e75;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .text_cell_render h1 {\n",
|
||||
" font-weight: 200;\n",
|
||||
" font-size: 30pt;\n",
|
||||
" line-height: 100%;\n",
|
||||
" color:#c76c0c;\n",
|
||||
" margin-bottom: 0.5em;\n",
|
||||
" margin-top: 1em;\n",
|
||||
" display: block;\n",
|
||||
" white-space: wrap;\n",
|
||||
" } \n",
|
||||
" h2 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" }\n",
|
||||
" .text_cell_render h2 {\n",
|
||||
" font-weight: 200;\n",
|
||||
" font-size: 16pt;\n",
|
||||
" font-style: italic;\n",
|
||||
" line-height: 100%;\n",
|
||||
" color:#c76c0c;\n",
|
||||
" margin-bottom: 0.5em;\n",
|
||||
" margin-top: 1.5em;\n",
|
||||
" display: inline;\n",
|
||||
" white-space: wrap;\n",
|
||||
" } \n",
|
||||
" h3 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" }\n",
|
||||
" .text_cell_render h3 {\n",
|
||||
" font-weight: 200;\n",
|
||||
" font-size: 14pt;\n",
|
||||
" line-height: 100%;\n",
|
||||
" color:#d77c0c;\n",
|
||||
" margin-bottom: 0.5em;\n",
|
||||
" margin-top: 2em;\n",
|
||||
" display: block;\n",
|
||||
" white-space: nowrap;\n",
|
||||
" }\n",
|
||||
" h4 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" }\n",
|
||||
" .text_cell_render h4 {\n",
|
||||
" font-weight: 100;\n",
|
||||
" font-size: 14pt;\n",
|
||||
" color:#d77c0c;\n",
|
||||
" margin-bottom: 0.5em;\n",
|
||||
" margin-top: 0.5em;\n",
|
||||
" display: block;\n",
|
||||
" white-space: nowrap;\n",
|
||||
" }\n",
|
||||
" h5 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" }\n",
|
||||
" .text_cell_render h5 {\n",
|
||||
" font-weight: 200;\n",
|
||||
" font-style: normal;\n",
|
||||
" color: #1d3b84;\n",
|
||||
" font-size: 16pt;\n",
|
||||
" margin-bottom: 0em;\n",
|
||||
" margin-top: 0.5em;\n",
|
||||
" display: block;\n",
|
||||
" white-space: nowrap;\n",
|
||||
" }\n",
|
||||
" div.text_cell_render{\n",
|
||||
" font-family: 'Arimo',verdana,arial,sans-serif;\n",
|
||||
" line-height: 125%;\n",
|
||||
" font-size: 120%;\n",
|
||||
" width:740px;\n",
|
||||
" margin-left:auto;\n",
|
||||
" margin-right:auto;\n",
|
||||
" text-align:justify;\n",
|
||||
" text-justify:inter-word;\n",
|
||||
" }\n",
|
||||
" div.output_subarea.output_text.output_pyout {\n",
|
||||
" overflow-x: auto;\n",
|
||||
" overflow-y: scroll;\n",
|
||||
" max-height: 50000px;\n",
|
||||
" }\n",
|
||||
" div.output_subarea.output_stream.output_stdout.output_text {\n",
|
||||
" overflow-x: auto;\n",
|
||||
" overflow-y: scroll;\n",
|
||||
" max-height: 50000px;\n",
|
||||
" }\n",
|
||||
" div.output_wrapper{\n",
|
||||
" margin-top:0.2em;\n",
|
||||
" margin-bottom:0.2em;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
" code{\n",
|
||||
" font-size: 70%;\n",
|
||||
" }\n",
|
||||
" .rendered_html code{\n",
|
||||
" background-color: transparent;\n",
|
||||
" }\n",
|
||||
" ul{\n",
|
||||
" margin: 2em;\n",
|
||||
" }\n",
|
||||
" ul li{\n",
|
||||
" padding-left: 0.5em; \n",
|
||||
" margin-bottom: 0.5em; \n",
|
||||
" margin-top: 0.5em; \n",
|
||||
" }\n",
|
||||
" ul li li{\n",
|
||||
" padding-left: 0.2em; \n",
|
||||
" margin-bottom: 0.2em; \n",
|
||||
" margin-top: 0.2em; \n",
|
||||
" }\n",
|
||||
" ol{\n",
|
||||
" margin: 2em;\n",
|
||||
" }\n",
|
||||
" ol li{\n",
|
||||
" padding-left: 0.5em; \n",
|
||||
" margin-bottom: 0.5em; \n",
|
||||
" margin-top: 0.5em; \n",
|
||||
" }\n",
|
||||
" ul li{\n",
|
||||
" padding-left: 0.5em; \n",
|
||||
" margin-bottom: 0.5em; \n",
|
||||
" margin-top: 0.2em; \n",
|
||||
" }\n",
|
||||
" a:link{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color:#447adb;\n",
|
||||
" }\n",
|
||||
" a:visited{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color: #1d3b84;\n",
|
||||
" }\n",
|
||||
" a:hover{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color: #1d3b84;\n",
|
||||
" }\n",
|
||||
" a:focus{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color:#447adb;\n",
|
||||
" }\n",
|
||||
" a:active{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color:#447adb;\n",
|
||||
" }\n",
|
||||
" .rendered_html :link {\n",
|
||||
" text-decoration: underline; \n",
|
||||
" }\n",
|
||||
" .rendered_html :hover {\n",
|
||||
" text-decoration: none; \n",
|
||||
" }\n",
|
||||
" .rendered_html :visited {\n",
|
||||
" text-decoration: none;\n",
|
||||
" }\n",
|
||||
" .rendered_html :focus {\n",
|
||||
" text-decoration: none;\n",
|
||||
" }\n",
|
||||
" .rendered_html :active {\n",
|
||||
" text-decoration: none;\n",
|
||||
" }\n",
|
||||
" .warning{\n",
|
||||
" color: rgb( 240, 20, 20 )\n",
|
||||
" } \n",
|
||||
" hr {\n",
|
||||
" color: #f3f3f3;\n",
|
||||
" background-color: #f3f3f3;\n",
|
||||
" height: 1px;\n",
|
||||
" }\n",
|
||||
" blockquote{\n",
|
||||
" display:block;\n",
|
||||
" background: #fcfcfc;\n",
|
||||
" border-left: 5px solid #c76c0c;\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" width:680px;\n",
|
||||
" padding: 10px 10px 10px 10px;\n",
|
||||
" text-align:justify;\n",
|
||||
" text-justify:inter-word;\n",
|
||||
" }\n",
|
||||
" blockquote p {\n",
|
||||
" margin-bottom: 0;\n",
|
||||
" line-height: 125%;\n",
|
||||
" font-size: 100%;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<script>\n",
|
||||
" MathJax.Hub.Config({\n",
|
||||
" TeX: {\n",
|
||||
" extensions: [\"AMSmath.js\"]\n",
|
||||
" },\n",
|
||||
" tex2jax: {\n",
|
||||
" inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
|
||||
" displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
|
||||
" },\n",
|
||||
" displayAlign: 'center', // Change this to 'center' to center equations.\n",
|
||||
" \"HTML-CSS\": {\n",
|
||||
" scale:85,\n",
|
||||
" styles: {'.MathJax_Display': {\"margin\": 4}}\n",
|
||||
" }\n",
|
||||
" });\n",
|
||||
"</script>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.HTML object>"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"#format the book\n",
|
||||
"%matplotlib inline\n",
|
||||
"from __future__ import division, print_function\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"import book_format\n",
|
||||
"book_format.load_style()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Symbology"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"This is just notes at this point. \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## State\n",
|
||||
"\n",
|
||||
"$x$ (Brookner, Zarchan, Brown)\n",
|
||||
"\n",
|
||||
"$\\underline{x}$ Gelb)\n",
|
||||
"\n",
|
||||
"## State at step n\n",
|
||||
"\n",
|
||||
"$x_n$ (Brookner)\n",
|
||||
"\n",
|
||||
"$x_k$ (Brown, Zarchan)\n",
|
||||
"\n",
|
||||
"$\\underline{x}_k$ (Gelb)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Prediction\n",
|
||||
"\n",
|
||||
"$x^-$\n",
|
||||
"\n",
|
||||
"$x_{n,n-1}$ (Brookner) \n",
|
||||
"\n",
|
||||
"$x_{k+1,k}$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## measurement\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"$x^*$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Y_n (Brookner)\n",
|
||||
"\n",
|
||||
"##control transition Matrix\n",
|
||||
"\n",
|
||||
"$G$ (Zarchan)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Not used (Brookner)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#Nomenclature\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Equations\n",
|
||||
"### Brookner\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"X^*_{n+1,n} &= \\Phi X^*_{n,n} \\\\\n",
|
||||
"X^*_{n,n} &= X^*_{n,n-1} +H_n(Y_n - MX^*_{n,n-1}) \\\\\n",
|
||||
"H_n &= S^*_{n,n-1}M^T[R_n + MS^*_{n,n-1}M^T]^{-1} \\\\\n",
|
||||
"S^*_{n,n-1} &= \\Phi S^*_{n-1,n-1}\\Phi^T + Q_n \\\\\n",
|
||||
"S^*_{n-1,n-1} &= (I-H_{n-1}M)S^*_{n-1,n-2}\n",
|
||||
"\\end{aligned}$$\n",
|
||||
"\n",
|
||||
"### Gelb\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\underline{\\hat{x}}_k(-) &= \\Phi_{k-1} \\underline{\\hat{x}}_{k-1}(+) \\\\\n",
|
||||
"\\underline{\\hat{x}}_k(+) &= \\underline{\\hat{x}}_k(-) +K_k[Z_k - H_k\\underline{\\hat{x}}_k(-)] \\\\\n",
|
||||
"K_k &= P_k(-)H_k^T[H_kP_k(-)H_k^T + R_k]^{-1}\\\\\n",
|
||||
"P_k(+) &= \\Phi_{k-1} P_{k-1}(+)\\Phi_{k-1}^T + Q_{k-1} \\\\\n",
|
||||
"P_k(-) &= (I-K_kH_k)P_k(-)\n",
|
||||
"\\end{aligned}$$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"### Brown\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\hat{\\textbf{x}}^-_{k+1} &= \\mathbf{\\phi}_{k}\\hat{\\textbf{x}}_{k} \\\\\n",
|
||||
"\\hat{\\textbf{x}}_k &= \\hat{\\textbf{x}}^-_k +\\textbf{K}_k[\\textbf{z}_k - \\textbf{H}_k\\hat{\\textbf{}x}^-_k] \\\\\n",
|
||||
"\\textbf{K}_k &= \\textbf{P}^-_k\\textbf{H}_k^T[\\textbf{H}_k\\textbf{P}^-_k\\textbf{H}_k^T + \\textbf{R}_k]^{-1}\\\\\n",
|
||||
"\\textbf{P}^-_{k+1} &= \\mathbf{\\phi}_k \\textbf{P}_k\\mathbf{\\phi}_k^T + \\textbf{Q}_{k} \\\\\n",
|
||||
"\\mathbf{P}_k &= (\\mathbf{I}-\\mathbf{K}_k\\mathbf{H}_k)\\mathbf{P}^-_k\n",
|
||||
"\\end{aligned}$$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"### Zarchan\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\hat{x}_{k} &= \\Phi_{k}\\hat{x}_{k-1} + G_ku_{k-1} + K_k[z_k - H\\Phi_{k}\\hat{x}_{k-1} - HG_ku_{k-1} ] \\\\\n",
|
||||
"M_{k} &= \\Phi_k P_{k-1}\\phi_k^T + Q_{k} \\\\\n",
|
||||
"K_k &= M_kH^T[HM_kH^T + R_k]^{-1}\\\\\n",
|
||||
"P_k &= (I-K_kH)M_k\n",
|
||||
"\\end{aligned}$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Wikipedia\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\hat{\\textbf{x}}_{k\\mid k-1} &= \\textbf{F}_{k}\\hat{\\textbf{x}}_{k-1\\mid k-1} + \\textbf{B}_{k} \\textbf{u}_{k} \\\\\n",
|
||||
"\\textbf{P}_{k\\mid k-1} &= \\textbf{F}_{k} \\textbf{P}_{k-1\\mid k-1} \\textbf{F}_{k}^{\\text{T}} + \\textbf{Q}_{k}\\\\\n",
|
||||
"\\tilde{\\textbf{y}}_k &= \\textbf{z}_k - \\textbf{H}_k\\hat{\\textbf{x}}_{k\\mid k-1} \\\\\n",
|
||||
"\\textbf{S}_k &= \\textbf{H}_k \\textbf{P}_{k\\mid k-1} \\textbf{H}_k^\\text{T} + \\textbf{R}_k \\\\\n",
|
||||
"\\textbf{K}_k &= \\textbf{P}_{k\\mid k-1}\\textbf{H}_k^\\text{T}\\textbf{S}_k^{-1} \\\\\n",
|
||||
"\\hat{\\textbf{x}}_{k\\mid k} &= \\hat{\\textbf{x}}_{k\\mid k-1} + \\textbf{K}_k\\tilde{\\textbf{y}}_k \\\\\n",
|
||||
"\\textbf{P}_{k|k} &= (I - \\textbf{K}_k \\textbf{H}_k) \\textbf{P}_{k|k-1}\n",
|
||||
"\\end{aligned}$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Labbe\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\hat{\\textbf{x}}^-_{k+1} &= \\mathbf{F}_{k}\\hat{\\textbf{x}}_{k} + \\mathbf{B}_k\\mathbf{u}_k \\\\\n",
|
||||
"\\textbf{P}^-_{k+1} &= \\mathbf{F}_k \\textbf{P}_k\\mathbf{F}_k^T + \\textbf{Q}_{k} \\\\\n",
|
||||
"\\textbf{y}_k &= \\textbf{z}_k - \\textbf{H}_k\\hat{\\textbf{}x}^-_k \\\\\n",
|
||||
"\\mathbf{S}_k &= \\textbf{H}_k\\textbf{P}^-_k\\textbf{H}_k^T + \\textbf{R}_k \\\\\n",
|
||||
"\\textbf{K}_k &= \\textbf{P}^-_k\\textbf{H}_k^T\\mathbf{S}_k^{-1} \\\\\n",
|
||||
"\\hat{\\textbf{x}}_k &= \\hat{\\textbf{x}}^-_k +\\textbf{K}_k\\textbf{y} \\\\\n",
|
||||
"\\mathbf{P}_k &= (\\mathbf{I}-\\mathbf{K}_k\\mathbf{H}_k)\\mathbf{P}^-_k\n",
|
||||
"\\end{aligned}$$"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.4.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<style>\n",
|
||||
"@import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n",
|
||||
"@import url('http://fonts.googleapis.com/css?family=Vollkorn');\n",
|
||||
"@import url('http://fonts.googleapis.com/css?family=Arimo');\n",
|
||||
"\n",
|
||||
" div.cell{\n",
|
||||
" width: 850px;\n",
|
||||
" margin-left: 0% !important;\n",
|
||||
" margin-right: auto;\n",
|
||||
" }\n",
|
||||
" div.text_cell code {\n",
|
||||
" background: transparent;\n",
|
||||
" color: #000000;\n",
|
||||
" font-weight: 600;\n",
|
||||
" font-size: 11pt;\n",
|
||||
" font-style: bold;\n",
|
||||
" font-family: 'Source Code Pro', Consolas, monocco, monospace;\n",
|
||||
" }\n",
|
||||
" h1 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
"\t}\n",
|
||||
"\t\n",
|
||||
" div.input_area {\n",
|
||||
" background: #F6F6F9;\n",
|
||||
" border: 1px solid #586e75;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .text_cell_render h1 {\n",
|
||||
" font-weight: 200;\n",
|
||||
" font-size: 30pt;\n",
|
||||
" line-height: 100%;\n",
|
||||
" color:#c76c0c;\n",
|
||||
" margin-bottom: 0.5em;\n",
|
||||
" margin-top: 1em;\n",
|
||||
" display: block;\n",
|
||||
" white-space: wrap;\n",
|
||||
" } \n",
|
||||
" h2 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" }\n",
|
||||
" .text_cell_render h2 {\n",
|
||||
" font-weight: 200;\n",
|
||||
" font-size: 16pt;\n",
|
||||
" font-style: italic;\n",
|
||||
" line-height: 100%;\n",
|
||||
" color:#c76c0c;\n",
|
||||
" margin-bottom: 0.5em;\n",
|
||||
" margin-top: 1.5em;\n",
|
||||
" display: inline;\n",
|
||||
" white-space: wrap;\n",
|
||||
" } \n",
|
||||
" h3 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" }\n",
|
||||
" .text_cell_render h3 {\n",
|
||||
" font-weight: 200;\n",
|
||||
" font-size: 14pt;\n",
|
||||
" line-height: 100%;\n",
|
||||
" color:#d77c0c;\n",
|
||||
" margin-bottom: 0.5em;\n",
|
||||
" margin-top: 2em;\n",
|
||||
" display: block;\n",
|
||||
" white-space: nowrap;\n",
|
||||
" }\n",
|
||||
" h4 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" }\n",
|
||||
" .text_cell_render h4 {\n",
|
||||
" font-weight: 100;\n",
|
||||
" font-size: 14pt;\n",
|
||||
" color:#d77c0c;\n",
|
||||
" margin-bottom: 0.5em;\n",
|
||||
" margin-top: 0.5em;\n",
|
||||
" display: block;\n",
|
||||
" white-space: nowrap;\n",
|
||||
" }\n",
|
||||
" h5 {\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" }\n",
|
||||
" .text_cell_render h5 {\n",
|
||||
" font-weight: 200;\n",
|
||||
" font-style: normal;\n",
|
||||
" color: #1d3b84;\n",
|
||||
" font-size: 16pt;\n",
|
||||
" margin-bottom: 0em;\n",
|
||||
" margin-top: 0.5em;\n",
|
||||
" display: block;\n",
|
||||
" white-space: nowrap;\n",
|
||||
" }\n",
|
||||
" div.text_cell_render{\n",
|
||||
" font-family: 'Arimo',verdana,arial,sans-serif;\n",
|
||||
" line-height: 125%;\n",
|
||||
" font-size: 120%;\n",
|
||||
" width:740px;\n",
|
||||
" margin-left:auto;\n",
|
||||
" margin-right:auto;\n",
|
||||
" text-align:justify;\n",
|
||||
" text-justify:inter-word;\n",
|
||||
" }\n",
|
||||
" div.output_subarea.output_text.output_pyout {\n",
|
||||
" overflow-x: auto;\n",
|
||||
" overflow-y: scroll;\n",
|
||||
" max-height: 50000px;\n",
|
||||
" }\n",
|
||||
" div.output_subarea.output_stream.output_stdout.output_text {\n",
|
||||
" overflow-x: auto;\n",
|
||||
" overflow-y: scroll;\n",
|
||||
" max-height: 50000px;\n",
|
||||
" }\n",
|
||||
" div.output_wrapper{\n",
|
||||
" margin-top:0.2em;\n",
|
||||
" margin-bottom:0.2em;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
" code{\n",
|
||||
" font-size: 70%;\n",
|
||||
" }\n",
|
||||
" .rendered_html code{\n",
|
||||
" background-color: transparent;\n",
|
||||
" }\n",
|
||||
" ul{\n",
|
||||
" margin: 2em;\n",
|
||||
" }\n",
|
||||
" ul li{\n",
|
||||
" padding-left: 0.5em; \n",
|
||||
" margin-bottom: 0.5em; \n",
|
||||
" margin-top: 0.5em; \n",
|
||||
" }\n",
|
||||
" ul li li{\n",
|
||||
" padding-left: 0.2em; \n",
|
||||
" margin-bottom: 0.2em; \n",
|
||||
" margin-top: 0.2em; \n",
|
||||
" }\n",
|
||||
" ol{\n",
|
||||
" margin: 2em;\n",
|
||||
" }\n",
|
||||
" ol li{\n",
|
||||
" padding-left: 0.5em; \n",
|
||||
" margin-bottom: 0.5em; \n",
|
||||
" margin-top: 0.5em; \n",
|
||||
" }\n",
|
||||
" ul li{\n",
|
||||
" padding-left: 0.5em; \n",
|
||||
" margin-bottom: 0.5em; \n",
|
||||
" margin-top: 0.2em; \n",
|
||||
" }\n",
|
||||
" a:link{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color:#447adb;\n",
|
||||
" }\n",
|
||||
" a:visited{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color: #1d3b84;\n",
|
||||
" }\n",
|
||||
" a:hover{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color: #1d3b84;\n",
|
||||
" }\n",
|
||||
" a:focus{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color:#447adb;\n",
|
||||
" }\n",
|
||||
" a:active{\n",
|
||||
" font-weight: bold;\n",
|
||||
" color:#447adb;\n",
|
||||
" }\n",
|
||||
" .rendered_html :link {\n",
|
||||
" text-decoration: underline; \n",
|
||||
" }\n",
|
||||
" .rendered_html :hover {\n",
|
||||
" text-decoration: none; \n",
|
||||
" }\n",
|
||||
" .rendered_html :visited {\n",
|
||||
" text-decoration: none;\n",
|
||||
" }\n",
|
||||
" .rendered_html :focus {\n",
|
||||
" text-decoration: none;\n",
|
||||
" }\n",
|
||||
" .rendered_html :active {\n",
|
||||
" text-decoration: none;\n",
|
||||
" }\n",
|
||||
" .warning{\n",
|
||||
" color: rgb( 240, 20, 20 )\n",
|
||||
" } \n",
|
||||
" hr {\n",
|
||||
" color: #f3f3f3;\n",
|
||||
" background-color: #f3f3f3;\n",
|
||||
" height: 1px;\n",
|
||||
" }\n",
|
||||
" blockquote{\n",
|
||||
" display:block;\n",
|
||||
" background: #fcfcfc;\n",
|
||||
" border-left: 5px solid #c76c0c;\n",
|
||||
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
|
||||
" width:680px;\n",
|
||||
" padding: 10px 10px 10px 10px;\n",
|
||||
" text-align:justify;\n",
|
||||
" text-justify:inter-word;\n",
|
||||
" }\n",
|
||||
" blockquote p {\n",
|
||||
" margin-bottom: 0;\n",
|
||||
" line-height: 125%;\n",
|
||||
" font-size: 100%;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<script>\n",
|
||||
" MathJax.Hub.Config({\n",
|
||||
" TeX: {\n",
|
||||
" extensions: [\"AMSmath.js\"]\n",
|
||||
" },\n",
|
||||
" tex2jax: {\n",
|
||||
" inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
|
||||
" displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
|
||||
" },\n",
|
||||
" displayAlign: 'center', // Change this to 'center' to center equations.\n",
|
||||
" \"HTML-CSS\": {\n",
|
||||
" scale:85,\n",
|
||||
" styles: {'.MathJax_Display': {\"margin\": 4}}\n",
|
||||
" }\n",
|
||||
" });\n",
|
||||
"</script>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.HTML object>"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"#format the book\n",
|
||||
"%matplotlib inline\n",
|
||||
"from __future__ import division, print_function\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"import book_format\n",
|
||||
"book_format.load_style()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Symbology"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"This is just notes at this point. \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## State\n",
|
||||
"\n",
|
||||
"$x$ (Brookner, Zarchan, Brown)\n",
|
||||
"\n",
|
||||
"$\\underline{x}$ Gelb)\n",
|
||||
"\n",
|
||||
"## State at step n\n",
|
||||
"\n",
|
||||
"$x_n$ (Brookner)\n",
|
||||
"\n",
|
||||
"$x_k$ (Brown, Zarchan)\n",
|
||||
"\n",
|
||||
"$\\underline{x}_k$ (Gelb)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Prediction\n",
|
||||
"\n",
|
||||
"$x^-$\n",
|
||||
"\n",
|
||||
"$x_{n,n-1}$ (Brookner) \n",
|
||||
"\n",
|
||||
"$x_{k+1,k}$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## measurement\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"$x^*$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Y_n (Brookner)\n",
|
||||
"\n",
|
||||
"##control transition Matrix\n",
|
||||
"\n",
|
||||
"$G$ (Zarchan)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Not used (Brookner)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"##Nomenclature\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"### Equations\n",
|
||||
"#### Brookner\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"X^*_{n+1,n} &= \\Phi X^*_{n,n} \\\\\n",
|
||||
"X^*_{n,n} &= X^*_{n,n-1} +H_n(Y_n - MX^*_{n,n-1}) \\\\\n",
|
||||
"H_n &= S^*_{n,n-1}M^T[R_n + MS^*_{n,n-1}M^T]^{-1} \\\\\n",
|
||||
"S^*_{n,n-1} &= \\Phi S^*_{n-1,n-1}\\Phi^T + Q_n \\\\\n",
|
||||
"S^*_{n-1,n-1} &= (I-H_{n-1}M)S^*_{n-1,n-2}\n",
|
||||
"\\end{aligned}$$\n",
|
||||
"\n",
|
||||
"#### Gelb\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\underline{\\hat{x}}_k(-) &= \\Phi_{k-1} \\underline{\\hat{x}}_{k-1}(+) \\\\\n",
|
||||
"\\underline{\\hat{x}}_k(+) &= \\underline{\\hat{x}}_k(-) +K_k[Z_k - H_k\\underline{\\hat{x}}_k(-)] \\\\\n",
|
||||
"K_k &= P_k(-)H_k^T[H_kP_k(-)H_k^T + R_k]^{-1}\\\\\n",
|
||||
"P_k(+) &= \\Phi_{k-1} P_{k-1}(+)\\Phi_{k-1}^T + Q_{k-1} \\\\\n",
|
||||
"P_k(-) &= (I-K_kH_k)P_k(-)\n",
|
||||
"\\end{aligned}$$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"#### Brown\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\hat{\\textbf{x}}^-_{k+1} &= \\mathbf{\\phi}_{k}\\hat{\\textbf{x}}_{k} \\\\\n",
|
||||
"\\hat{\\textbf{x}}_k &= \\hat{\\textbf{x}}^-_k +\\textbf{K}_k[\\textbf{z}_k - \\textbf{H}_k\\hat{\\textbf{}x}^-_k] \\\\\n",
|
||||
"\\textbf{K}_k &= \\textbf{P}^-_k\\textbf{H}_k^T[\\textbf{H}_k\\textbf{P}^-_k\\textbf{H}_k^T + \\textbf{R}_k]^{-1}\\\\\n",
|
||||
"\\textbf{P}^-_{k+1} &= \\mathbf{\\phi}_k \\textbf{P}_k\\mathbf{\\phi}_k^T + \\textbf{Q}_{k} \\\\\n",
|
||||
"\\mathbf{P}_k &= (\\mathbf{I}-\\mathbf{K}_k\\mathbf{H}_k)\\mathbf{P}^-_k\n",
|
||||
"\\end{aligned}$$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"#### Zarchan\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\hat{x}_{k} &= \\Phi_{k}\\hat{x}_{k-1} + G_ku_{k-1} + K_k[z_k - H\\Phi_{k}\\hat{x}_{k-1} - HG_ku_{k-1} ] \\\\\n",
|
||||
"M_{k} &= \\Phi_k P_{k-1}\\phi_k^T + Q_{k} \\\\\n",
|
||||
"K_k &= M_kH^T[HM_kH^T + R_k]^{-1}\\\\\n",
|
||||
"P_k &= (I-K_kH)M_k\n",
|
||||
"\\end{aligned}$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Wikipedia\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\hat{\\textbf{x}}_{k\\mid k-1} &= \\textbf{F}_{k}\\hat{\\textbf{x}}_{k-1\\mid k-1} + \\textbf{B}_{k} \\textbf{u}_{k} \\\\\n",
|
||||
"\\textbf{P}_{k\\mid k-1} &= \\textbf{F}_{k} \\textbf{P}_{k-1\\mid k-1} \\textbf{F}_{k}^{\\text{T}} + \\textbf{Q}_{k}\\\\\n",
|
||||
"\\tilde{\\textbf{y}}_k &= \\textbf{z}_k - \\textbf{H}_k\\hat{\\textbf{x}}_{k\\mid k-1} \\\\\n",
|
||||
"\\textbf{S}_k &= \\textbf{H}_k \\textbf{P}_{k\\mid k-1} \\textbf{H}_k^\\text{T} + \\textbf{R}_k \\\\\n",
|
||||
"\\textbf{K}_k &= \\textbf{P}_{k\\mid k-1}\\textbf{H}_k^\\text{T}\\textbf{S}_k^{-1} \\\\\n",
|
||||
"\\hat{\\textbf{x}}_{k\\mid k} &= \\hat{\\textbf{x}}_{k\\mid k-1} + \\textbf{K}_k\\tilde{\\textbf{y}}_k \\\\\n",
|
||||
"\\textbf{P}_{k|k} &= (I - \\textbf{K}_k \\textbf{H}_k) \\textbf{P}_{k|k-1}\n",
|
||||
"\\end{aligned}$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Labbe\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\hat{\\textbf{x}}^-_{k+1} &= \\mathbf{F}_{k}\\hat{\\textbf{x}}_{k} + \\mathbf{B}_k\\mathbf{u}_k \\\\\n",
|
||||
"\\textbf{P}^-_{k+1} &= \\mathbf{F}_k \\textbf{P}_k\\mathbf{F}_k^T + \\textbf{Q}_{k} \\\\\n",
|
||||
"\\textbf{y}_k &= \\textbf{z}_k - \\textbf{H}_k\\hat{\\textbf{}x}^-_k \\\\\n",
|
||||
"\\mathbf{S}_k &= \\textbf{H}_k\\textbf{P}^-_k\\textbf{H}_k^T + \\textbf{R}_k \\\\\n",
|
||||
"\\textbf{K}_k &= \\textbf{P}^-_k\\textbf{H}_k^T\\mathbf{S}_k^{-1} \\\\\n",
|
||||
"\\hat{\\textbf{x}}_k &= \\hat{\\textbf{x}}^-_k +\\textbf{K}_k\\textbf{y} \\\\\n",
|
||||
"\\mathbf{P}_k &= (\\mathbf{I}-\\mathbf{K}_k\\mathbf{H}_k)\\mathbf{P}^-_k\n",
|
||||
"\\end{aligned}$$"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.4.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Walking through the Kalman Filter code"
|
||||
"# Walking through the Kalman Filter code"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
File diff suppressed because one or more lines are too long
1379
Appendix_F_FilterPy_Code.ipynb
Normal file
1379
Appendix_F_FilterPy_Code.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,56 +1,55 @@
|
||||
from __future__ import print_function
|
||||
import io
|
||||
import IPython.nbformat as nbformat
|
||||
import sys
|
||||
from formatting import *
|
||||
|
||||
|
||||
def merge_notebooks(outfile, filenames):
|
||||
merged = None
|
||||
added_appendix = False
|
||||
for fname in filenames:
|
||||
with io.open(fname, 'r', encoding='utf-8') as f:
|
||||
nb = nbformat.read(f, nbformat.NO_CONVERT)
|
||||
remove_formatting(nb)
|
||||
if not added_appendix and fname[0:8] == 'Appendix':
|
||||
remove_links_add_appendix(nb)
|
||||
added_appendix = True
|
||||
else:
|
||||
remove_links(nb)
|
||||
if merged is None:
|
||||
merged = nb
|
||||
else:
|
||||
merged.cells.extend(nb.cells)
|
||||
#merged.metadata.name += "_merged"
|
||||
|
||||
outfile.write(nbformat.writes(merged, nbformat.NO_CONVERT))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
f = open('book.ipynb', 'w', encoding='utf-8')
|
||||
'''merge_notebooks(
|
||||
['../00_Preface.ipynb',
|
||||
'../01_g-h_filter.ipynb',
|
||||
'../Appendix_A_Installation.ipynb'])'''
|
||||
|
||||
merge_notebooks(f,
|
||||
['../00_Preface.ipynb',
|
||||
'../01_g-h_filter.ipynb',
|
||||
'../02_Discrete_Bayes.ipynb',
|
||||
'../03_Least_Squares_Filters.ipynb',
|
||||
'../04_Gaussians.ipynb',
|
||||
'../05_Kalman_Filters.ipynb',
|
||||
'../06_Multivariate_Kalman_Filters.ipynb',
|
||||
'../07_Kalman_Filter_Math.ipynb',
|
||||
'../08_Designing_Kalman_Filters.ipynb',
|
||||
'../09_Nonlinear_Filtering.ipynb',
|
||||
'../10_Unscented_Kalman_Filter.ipynb',
|
||||
'../11_Extended_Kalman_Filters.ipynb',
|
||||
'../12_Designing_Nonlinear_Kalman_Filters.ipynb',
|
||||
'../13_Particle_Filters.ipynb',
|
||||
'../14_Smoothing.ipynb',
|
||||
'../15_Adaptive_Filtering.ipynb',
|
||||
'../16_HInfinity_Filters.ipynb',
|
||||
'../17_Ensemble_Kalman_Filters.ipynb',
|
||||
'../Appendix_A_Installation.ipynb',
|
||||
'../Appendix_B_Symbols_and_Notations.ipynb'])
|
||||
from __future__ import print_function
|
||||
import io
|
||||
import IPython.nbformat as nbformat
|
||||
import sys
|
||||
from formatting import *
|
||||
|
||||
|
||||
def merge_notebooks(outfile, filenames):
|
||||
merged = None
|
||||
added_appendix = False
|
||||
for fname in filenames:
|
||||
with io.open(fname, 'r', encoding='utf-8') as f:
|
||||
nb = nbformat.read(f, nbformat.NO_CONVERT)
|
||||
remove_formatting(nb)
|
||||
if not added_appendix and fname[0:8] == 'Appendix':
|
||||
remove_links_add_appendix(nb)
|
||||
added_appendix = True
|
||||
else:
|
||||
remove_links(nb)
|
||||
if merged is None:
|
||||
merged = nb
|
||||
else:
|
||||
merged.cells.extend(nb.cells)
|
||||
#merged.metadata.name += "_merged"
|
||||
|
||||
outfile.write(nbformat.writes(merged, nbformat.NO_CONVERT))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
f = open('book.ipynb', 'w', encoding='utf-8')
|
||||
'''merge_notebooks(
|
||||
['../00_Preface.ipynb',
|
||||
'../01_g-h_filter.ipynb',
|
||||
'../Appendix_A_Installation.ipynb'])'''
|
||||
|
||||
merge_notebooks(f,
|
||||
['../00_Preface.ipynb',
|
||||
'../01_g-h_filter.ipynb',
|
||||
'../02_Discrete_Bayes.ipynb',
|
||||
'../03_Least_Squares_Filters.ipynb',
|
||||
'../04_Gaussians.ipynb',
|
||||
'../05_Kalman_Filters.ipynb',
|
||||
'../06_Multivariate_Kalman_Filters.ipynb',
|
||||
'../07_Kalman_Filter_Math.ipynb',
|
||||
'../08_Designing_Kalman_Filters.ipynb',
|
||||
'../09_Nonlinear_Filtering.ipynb',
|
||||
'../10_Unscented_Kalman_Filter.ipynb',
|
||||
'../11_Extended_Kalman_Filters.ipynb',
|
||||
'../12_Designing_Nonlinear_Kalman_Filters.ipynb',
|
||||
#'../13_Particle_Filters.ipynb',
|
||||
'../14_Smoothing.ipynb',
|
||||
'../15_Adaptive_Filtering.ipynb',
|
||||
'../Appendix_A_Installation.ipynb',
|
||||
'../Appendix_B_Symbols_and_Notations.ipynb',
|
||||
'../Appendix_C_Walking_Through_KF_Code.ipynb'])
|
||||
|
@ -15,7 +15,7 @@
|
||||
"Motivation behind writing the book. How to download and read the book. Requirements for IPython Notebook and Python. github links.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 1: The g-h Filter ($\\alpha$-$\\beta$ Filter)**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/01_g-h_filter.ipynb)\n",
|
||||
"[**Chapter 1: The g-h Filter**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/01_g-h_filter.ipynb)\n",
|
||||
"\n",
|
||||
"Intuitive introduction to the g-h filter, also known as the $\\alpha$-$\\beta$ Filter, which is a family of filters that includes the Kalman filter. Once you understand this chapter you will understand the concepts behind the Kalman filter. \n",
|
||||
"\n",
|
||||
@ -92,25 +92,6 @@
|
||||
"Kalman filters assume a single process model, but manuevering targets typically need to be described by several different process models. Adaptive filtering uses several techniques to allow the Kalman filter to adapt to the changing behavior of the target.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 16: H-Infinity Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/16_HInfinity_Filters.ipynb)\n",
|
||||
" \n",
|
||||
"Describes the $H_\\infty$ filter. \n",
|
||||
"\n",
|
||||
"*I have code that implements the filter, but no supporting text yet.*\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter 17: Ensemble Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/17_Ensemble_Kalman_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"Discusses the ensemble Kalman Filter, which uses a Monte Carlo approach to deal with very large Kalman filter states in nonlinear systems.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Chapter XX: Numerical Stability**](not implemented)\n",
|
||||
"\n",
|
||||
"EKF and UKF are linear approximations of nonlinear problems. Unless programmed carefully, they are not numerically stable. We discuss some common approaches to this problem.\n",
|
||||
"\n",
|
||||
"*This chapter is not started. I'm likely to rearrange where this material goes - this is just a placeholder.*\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Appendix A: Installation, Python, NumPy, and FilterPy**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Appendix_A_Installation.ipynb)\n",
|
||||
"\n",
|
||||
"Brief introduction of Python and how it is used in this book. Description of the companion\n",
|
||||
@ -128,6 +109,23 @@
|
||||
"\n",
|
||||
"A brief walkthrough of the KalmanFilter class from FilterPy.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Appendix D: H-Infinity Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/16_HInfinity_Filters.ipynb)\n",
|
||||
" \n",
|
||||
"Describes the $H_\\infty$ filter. \n",
|
||||
"\n",
|
||||
"*I have code that implements the filter, but no supporting text yet.*\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Appendix E: Ensemble Kalman Filters**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/17_Ensemble_Kalman_Filters.ipynb)\n",
|
||||
"\n",
|
||||
"Discusses the ensemble Kalman Filter, which uses a Monte Carlo approach to deal with very large Kalman filter states in nonlinear systems.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"[**Appendix F: FilterPy Source Code**](http://nbviewer.ipython.org/urls/raw.github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/master/Appendix_D_Filterpy_Code.ipynb)\n",
|
||||
"\n",
|
||||
"Listings of important classes from FilterPy that are used in this book.\n",
|
||||
"\n",
|
||||
"### Github repository\n",
|
||||
"http://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python\n"
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user