Commit 427e88e6 authored by Frédéric Karamé's avatar Frédéric Karamé

Correct the calculation of the incremental weights.

parent 857168dd
...@@ -42,11 +42,12 @@ proposal = probability2(mut_t,sqr_Pss_t_t,particles) ; ...@@ -42,11 +42,12 @@ proposal = probability2(mut_t,sqr_Pss_t_t,particles) ;
prior = probability2(st_t_1,sqr_Pss_t_t_1,particles) ; prior = probability2(st_t_1,sqr_Pss_t_t_1,particles) ;
% likelihood % likelihood
yt_t_1_i = measurement_equations(particles,ReducedForm,ThreadsOptions) ; yt_t_1_i = measurement_equations(particles,ReducedForm,ThreadsOptions) ;
eta_t_i = bsxfun(@minus,obs,yt_t_1_i)' ; %eta_t_i = bsxfun(@minus,obs,yt_t_1_i)' ;
yt_t_1 = sum(yt_t_1_i*weigths1,2) ; %yt_t_1 = sum(yt_t_1_i*weigths1,2) ;
tmp = bsxfun(@minus,yt_t_1_i,yt_t_1) ; %tmp = bsxfun(@minus,yt_t_1_i,yt_t_1) ;
Pyy = bsxfun(@times,weigths2',tmp)*tmp' + H ; %Pyy = bsxfun(@times,weigths2',tmp)*tmp' + H ;
sqr_det = sqrt(det(Pyy)) ; %sqr_det = sqrt(det(Pyy)) ;
foo = (eta_t_i/Pyy).*eta_t_i ; %foo = (eta_t_i/Pyy).*eta_t_i ;
likelihood = exp(-0.5*sum(foo,2))/(normconst*sqr_det) + 1e-99 ; %likelihood = exp(-0.5*sum(foo,2))/(normconst*sqr_det) + 1e-99 ;
likelihood = probability2(obs,sqrt(H),yt_t_1_i) ;
IncrementalWeights = likelihood.*prior./proposal ; IncrementalWeights = likelihood.*prior./proposal ;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment