Created
October 17, 2016 08:31
-
-
Save sandyUni/36d868dc8192432e2dbccd450d28bc43 to your computer and use it in GitHub Desktop.
resample method in particle filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [ indx ] = resampleSystematic(w,N) | |
Q = cumsum(w); | |
T = linspace(0,1-1/N,N) + rand(1)/N; | |
T(N+1) = 1; | |
i=1; | |
j=1; | |
indx = zeros(N,1); | |
while (i<=N), | |
if (T(i)<Q(j)), | |
indx(i)=j; | |
i=i+1; | |
else | |
j=j+1; | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment