{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# Particle Filter Localization\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "## How to calculate covariance matrix from particles\n",
    "\n",
    "The covariance matrix $\\Xi$ from particle information is calculated by the following equation: \n",
    "\n",
    "$\\Xi_{j,k}=\\frac{1}{1-\\sum^N_{i=1}(w^i)^2}\\sum^N_{i=1}w^i(x^i_j-\\mu_j)(x^i_k-\\mu_k)$\n",
    "\n",
    "- $\\Xi_{j,k}$ is covariance matrix element at row $i$ and column $k$.\n",
    "\n",
    "- $w^i$ is the weight of the $i$ th particle. \n",
    "\n",
    "- $x^i_j$ is the $j$ th state of the $i$ th particle. \n",
    "\n",
    "- $\\mu_j$ is the $j$ th mean state of particles.\n",
    "\n",
    "Ref:\n",
    "\n",
    "- [Improving the particle filter in high dimensions using conjugate artificial process noise](https://arxiv.org/pdf/1801.07000.pdf)\n"
   ],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "source": [],
    "metadata": {
     "collapsed": false
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}