Starting from:

$30

ECE 8540 Lab 6 - Particle Filter

ECE 8540
Lab 6 - Particle Filter

1 Introduction
This lab report concerns the problem of applying a particle filter to a set of measurements.
The measurements are numerical data that has been recorded over time in order to provide
samples to filter. The measurements were recorded for a system that consists of a 1D
position, moving on a line. The motion pattern of the system is an oscillation over the line.
The sensor used in the system recoded a field strength that was the sum from two magnets
at fixed positions. The particle filter was used to actively filter the measurements read in
at each time step, allowing for more accurate state predictions. Unlike the previously used
Kalman filters, the particle filter lets us model systems where there is non-Gaussian noise.
The particle filter can filter data from a wider range of systems. It can handle systems where
the noise is believed to be Gaussian or non-Gaussian and it can also handle systems that
are linear or non-linear. Both the Kalman and extended Kalman filters are limited to the
range of problems they are able to filter. The particle filter improves upon these methods to
provide a solution that can be applied to a wider range of problems with proper knowledge
of the system. Since the particle filter has been introduced it has widely been considered the
best filtering method to accurately track system states.
2 Methods
The particle filter follows a cycle of prediction and update. In this cycle the next state is
calculated for each particle. Then the measurement from the current time step is obtained.
Using the new measurement the weight for each particle is updated. The weights are then
normalized so that they all sum to one. A desired output is then computed. The desired
output used in this lab was the expected value. Finally, there is a test to determine whether
or not resampling is required. Resampling is performed if necessary and the process is
repeated over the next time step.
When using the particle filter it is important to note that certain filter variables needed
to be initialized. For this specific implementation of the lab those variables included the
initial state and weight for each particle, the number of particles, the resampling threshold
and a variety of noise constraints. The initial state for each particle was set to be 0. The
initial weight for each particle was set to 1/M where M is the number of particles. The value
of M was experimented with but fell in the range from 100 to 1000. The steps mentioned in
the previous paragraph are further broken down below and the necessary equations are as
follows:
1
In this problem there was two state variables, position and velocity.
Xt =

xt
sx˙t

(1)
1. Calculate the next state for each particle m with the following state transition equation:
{x
(m)
t = f(x
(m)
t−1
, a
(m)
t
)}
M
m=1 (2)
Where f(x
(m)
t−1
, a
(m)
t
) is defined as the following:
f(xt
, at) =






xt+1 = xt + ˙xtT
x˙t+1 =



2 if xt < −20
x˙t + |at
| if −20 ≤ xt < 0
x˙t − |at
| if 0 ≤ xt ≤ 20
−2 if xt > 20






(3)
In equation 3 the input xt represents the state variable vector and at represents the dynamic noise. The dynamic noise, at was drawn from a zero-mean Gaussian distribution
N(0, σ2
a
). Where σa was defined to be 2−4
.
2. Obtain the measurement of magnetic strength from the sensor.
Yt =

yt

(4)
3. Calculate the ideal measurement using the observation equation for the model.
g(xt
, nt) = h
yt = √
1
2πσm
exp( −(xt−xm1)
2
2σ2m
) + √
1
2πσm
exp( −(xt−xm2)
2
2σ2m
) + nt
i
(5)
In equation 5, Xm1 = −10 and Xm2 = 10 representing the locations of the magnets
in the model. The value σm = 4. The input variable nt represents the measurement
noise and is pulled from the zero-mean Gaussian distribution N(0, σ2
n
). Where σn
was defined to be 2−8
. When solving for the ideal measurement of each particle it is
assumed that nt = 0 to represent no noise.
4. Use the ideal measurement calculated for each particle to compare against the actual
measurement from the model of the measurement noise. This comparison can be done
using the following equation:
p(yt
|x
(m)
t
) = 1

2πσn
exp(−(y
(m)
t − yt)
2

2
n
) (6)
5. Calculate the weight updates for each particle using the following equation:

(m)
t = w
(m)
t−1
· p(yt
|x
(m)
t
) (7)
2

More products