Correct the calculation of the incremental weights.
parent
28f7c7621b
commit
1f08164b05
|
@ -46,11 +46,12 @@ prior = prior' ;
|
|||
proposal = proposal' ;
|
||||
% Compute the density of the current observation conditionally to each particle
|
||||
yt_t_1_i = measurement_equations(StateParticles,ReducedForm,ThreadsOptions) ;
|
||||
eta_t_i = bsxfun(@minus,obs,yt_t_1_i)' ;
|
||||
yt_t_1 = sum(yt_t_1_i*weigths1,2) ;
|
||||
tmp = bsxfun(@minus,yt_t_1_i,yt_t_1) ;
|
||||
Pyy = bsxfun(@times,weigths2',tmp)*tmp' + H ;
|
||||
sqr_det = sqrt(det(Pyy)) ;
|
||||
foo = (eta_t_i/Pyy).*eta_t_i ;
|
||||
likelihood = exp(-0.5*sum(foo,2))/(normconst*sqr_det) + 1e-99 ;
|
||||
%eta_t_i = bsxfun(@minus,obs,yt_t_1_i)' ;
|
||||
%yt_t_1 = sum(yt_t_1_i*weigths1,2) ;
|
||||
%tmp = bsxfun(@minus,yt_t_1_i,yt_t_1) ;
|
||||
%Pyy = bsxfun(@times,weigths2',tmp)*tmp' + H ;
|
||||
%sqr_det = sqrt(det(Pyy)) ;
|
||||
%foo = (eta_t_i/Pyy).*eta_t_i ;
|
||||
%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 ;
|
||||
|
|
Loading…
Reference in New Issue