|||
function weight_new = kernel_density_estimation(X,particles,weight)
% clear all
% close all
% clc
% particles = [normrnd(-2,1,[1,100]),normrnd(2,1,[1,100])];
% weights = ones(1,200)/200;
% X = particles;
[a,b] = size(X);
if nargin<3
weight = ones(1,b)/b;
end
weight_new = zeros(1,b);
for i = 1:b
weight_new(i) = sum(mvnpdf(particles',X(:,i)',0.4*eye(a)).*weight');
end
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-24 02:24
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社