File Exchange

image thumbnail

Particle filter tutorial

Implementation of the generic particle filter

3.71429
7 Ratings

118 Downloads

Updated

View License

This file implements the particle filter described in

Arulampalam et. al. (2002). A tutorial on particle filters for online nonlinear/non-gaussian bayesian tracking. IEEE Transactions on Signal Processing. 50 (2). p 174--188

Heavily commented code included

Comments and Ratings (13)

pu hongping

thanks a lot

mau

mau (view profile)

Hello, is there anybody found a solution to the problem of having more than one observation?
Thanks

Simon Mpasi

I want to verify that this is good code.

Ilias Konsoulas

manh 123

Particle filter is explained through example of color tracking in here: https://github.com/trungmanhhuynh/-C-Pixel-wise-Color-Tracking-using-Particle-Filter

Michael

Statistics and Machine Learning Toolbox
required

pangpang jz

thanks

Nima

Nima (view profile)

add regularized PF

case 'regularized_pf'
       
       %reasmple
       edges = min([0 cumsum(wk)'],1); % protect against accumulated round-off
       edges(end) = 1; % get the upper edge exact
       u1 = rand/Ns;
      
       [~, idx] = histc(u1:1/Ns:1, edges);
       xk = xk(:,idx); % extract new particles
       wk = repmat(1/Ns, 1, Ns); % now all particles have the same weight
       
       %according to Mussao et al., 2001
       % compute empirical covariance of particles
       emp_cov=cov(xk')';
       % form D'*D=emp_cov
       dd=cholcov(emp_cov);
           
       nx=size(xk,1);
       %unit sphere volume (in two dimensions)
       cc=pi;
       %form the optimal choice of bandwidth
       aa=(8*(1/cc)*(nx+4)*(2*pi^.5)^nx)^(1/(nx+4));
       hopt=aa*Ns^(-1/(nx+4));
       % form an estimation of continuous pdf via epanechnikov kernel
       [f,~] = ksdensity(wk,'npoints',length(wk),'kernel','epanechnikov');
       f=f/sum(f);
       % compute the cumulative of the continuous distribution
       edges = min([0 cumsum(f)],1); % protect against accumulated round-off
       edges(end) = 1; % get the upper edge exact
       %sample from the inverse of cumulative of continuous density
       u1 = rand/Ns;
       [~, idx] = histc(u1:1/Ns:1, edges);
       ee=xk(:,idx);
       %move all samples to centre
       ee=ee-repmat(mean(ee,2),1,length(ee));
       % adjust resampled particles
       xk = xk+hopt*dd*ee; % extract new particles
       wk = repmat(1/Ns, 1, Ns);

soheil

soheil (view profile)

Dear Dr. Alvarez,
I am using your Particle Filter code and that is great. Right now, I am changing that to solve my problem. The problem has observation likelihood with more than two dimensions. I was wondering how I can model observation likelihood "p_yk_given_xk". Any idea for that will be really appreciated.

Regards,

Soheil

Jesús Lucio

Thanks a lot.

SaiNave

not helpful it is so complexed :(

GOOD

Updates

1.1

Changed title

MATLAB Release
MATLAB 7.8 (R2009a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video