approximate_gauss_by_kernels.m

来自「用粒子滤波算法进行跟踪的matlab代码。」· M 代码 · 共 48 行

M
48
字号
function g = approximate_gauss_by_kernels(x,P,N,type)
%function g = approximate_gauss_by_kernels(x,P,N,type)
%
% INPUTS: 
%   x,P - mean and covariance matrix of a Gaussian
%   N - number of components in output 
%   type - method used
%
% OUTPUT:
%   g - Gaussian kernels approximation of Gaussian
%
% This function is in alpha stage of development.
%
% Tim Bailey 2005.

if N == 1, type = 1; elseif nargin == 3, type = 2; end

switch type
case 1
    % Trivial solution
    g.w = ones(1,N)/N;
    g.x = repcol(x,N);
    g.P = P;
case 2
    % Musso
    g.w = ones(1,N)/N;
    g.x = gauss_samples(x,P,N);

    D = size(x,1);
    h = (4 / (N*(D+2))) ^ (2/(D+4));
    g.P = h*P;
case 3
    % Salmond
    g.w = ones(1,N)/N;
    g.x = gauss_samples(x,P,N);

    K = 0.5; % salmond's recommended constant term
    D = size(x,1);
    h = K*N^(-2/D); 
    g.P = h*P;
otherwise
    error('Invalid type')
end

% Other ideas:
%   - sample from broader (flatter) distribution and apply importance weights
% 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?