Major rewrites due to discrete bayes changes.
I've derived the x + Ky form for the univariate kalman filter. I completely reordered material, cutting about 10 pages (pdf) of material. I made the connection between the bayesian form and orthogonal form more explicit. Probably there are a lot of grammatical errors, but I wanted to get these checked in. I also altered the css - mainly the font.
This commit is contained in:
@@ -1,23 +1,62 @@
|
||||
<style>
|
||||
@import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');
|
||||
@import url('http://fonts.googleapis.com/css?family=Vollkorn');
|
||||
@import url('http://fonts.googleapis.com/css?family=Arimo');
|
||||
@import url('http://fonts.googleapis.com/css?family=Fira+sans');
|
||||
@import url('http://fonts.googleapis.com/css?family=Lora');
|
||||
|
||||
//@import url('http://fonts.googleapis.com/css?family=Open+Sans');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Vollkorn');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Karla');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Poppins');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Arimo');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Roboto');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Lato');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Domine');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Chivo');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Cardo');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Arvo');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Crimson+Text');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Ubuntu');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Fontin');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Raleway');
|
||||
//@import url('http://fonts.googleapis.com/css?family=Merriweather');
|
||||
|
||||
|
||||
.CodeMirror pre {
|
||||
font-family: 'Source Code Pro', Consolas, monocco, monospace;
|
||||
}
|
||||
div.cell{
|
||||
width: 900px;
|
||||
width: 800px;
|
||||
margin-left: 0% !important;
|
||||
margin-right: auto;
|
||||
}
|
||||
div.text_cell_render{
|
||||
font-family: 'Lora';
|
||||
//font-family: 'Open Sans';
|
||||
//font-family: 'Karla',verdana,arial,sans-serif;
|
||||
//font-family: 'Roboto',verdana,arial,sans-serif;
|
||||
//font-family: 'Lato',verdana,arial,sans-serif;
|
||||
//font-family: 'Domine',verdana,arial,sans-serif;
|
||||
//font-family: 'Chivo',verdana,arial,sans-serif;
|
||||
//font-family: 'Cardo',verdana,arial,sans-serif;
|
||||
//font-family: 'Arvo',verdana,arial,sans-serif;
|
||||
//font-family: 'Poppins',verdana,arial,sans-serif;
|
||||
//font-family: 'Ubuntu',verdana,arial,sans-serif;
|
||||
//font-family: 'Fontin',verdana,arial,sans-serif;
|
||||
//font-family: 'Raleway',verdana,arial,sans-serif;
|
||||
//font-family: 'Merriweather',verdana,arial,sans-serif;
|
||||
//font-family: 'Crimson Text', verdana,arial,sans-serif;
|
||||
//font-family: verdana,arial,sans-serif;
|
||||
//font-family: arial,sans-serif;
|
||||
line-height: 125%;
|
||||
font-size: 130%;
|
||||
text-align: justify;
|
||||
text-justify:inter-word;
|
||||
}
|
||||
div.text_cell code {
|
||||
background: transparent;
|
||||
color: #000000;
|
||||
font-weight: 600;
|
||||
font-weight: 400;
|
||||
font-size: 12pt;
|
||||
font-style: bold;
|
||||
//font-style: bold;
|
||||
font-family: 'Source Code Pro', Consolas, monocco, monospace;
|
||||
}
|
||||
h1 {
|
||||
@@ -96,13 +135,6 @@
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
}
|
||||
div.text_cell_render{
|
||||
/*font-family: 'Vollkorn', verdana,arial,sans-serif;*/
|
||||
line-height: 150%;
|
||||
font-size: 130%;
|
||||
text-align: justify;
|
||||
text-justify:inter-word;
|
||||
}
|
||||
div.output_subarea.output_text.output_pyout {
|
||||
overflow-x: auto;
|
||||
overflow-y: scroll;
|
||||
|
||||
@@ -17,7 +17,12 @@ from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import book_plots as bp
|
||||
import filterpy.stats as stats
|
||||
from math import sqrt
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from numpy.random import randn, seed
|
||||
|
||||
|
||||
def plot_dog_track(xs, dog, measurement_var, process_var):
|
||||
N = len(xs)
|
||||
@@ -42,4 +47,47 @@ def print_variance(positions):
|
||||
print('Variance:')
|
||||
for i in range(0, len(positions), 5):
|
||||
print('\t{:.4f} {:.4f} {:.4f} {:.4f} {:.4f}'.format(
|
||||
*[v[1] for v in positions[i:i+5]]))
|
||||
*[v[1] for v in positions[i:i+5]]))
|
||||
|
||||
|
||||
|
||||
def gaussian_vs_histogram():
|
||||
|
||||
seed(15)
|
||||
xs = np.arange(0, 20, 0.1)
|
||||
ys = np.array([stats.gaussian(x-10, 0, 2) for x in xs])
|
||||
bar_ys = abs(ys + randn(len(xs)) * stats.gaussian(xs-10, 0, 10)/2)
|
||||
plt.gca().bar(xs[::5]-.25, bar_ys[::5], width=0.5, color='g')
|
||||
plt.plot(xs, ys, lw=3, color='k')
|
||||
plt.xlim(5, 15)
|
||||
|
||||
|
||||
class DogSimulation(object):
|
||||
def __init__(self, x0=0, velocity=1,
|
||||
measurement_var=0.0,
|
||||
process_var=0.0):
|
||||
""" x0 : initial position
|
||||
velocity: (+=right, -=left)
|
||||
measurement_var: variance in measurement m^2
|
||||
process_var: variance in process (m/s)^2
|
||||
"""
|
||||
self.x = x0
|
||||
self.velocity = velocity
|
||||
self.meas_std = sqrt(measurement_var)
|
||||
self.process_std = sqrt(process_var)
|
||||
|
||||
def move(self, dt=1.0):
|
||||
"""Compute new position of the dog in dt seconds."""
|
||||
dx = self.velocity + randn()*self.process_std
|
||||
self.x += dx * dt
|
||||
|
||||
def sense_position(self):
|
||||
""" Returns measurement of new position in meters."""
|
||||
measurement = self.x + randn()*self.meas_std
|
||||
return measurement
|
||||
|
||||
def move_and_sense(self):
|
||||
""" Move dog, and return measurement of new position in meters"""
|
||||
self.move()
|
||||
return self.sense_position()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user