gusucode.com > 用粒子滤波算法进行跟踪的matlab代码 > gmm_utilities/gmm_reduce_truncate.m

    function g = gmm_reduce_truncate(g, N)

if size(g.x,2) <= N, return, end

[dmy, i] = sort(-g.w); % minus to give descending order
i = i(1:N);
g.x = g.x(:,i);
g.P = g.P(:,:,i);
g.w = g.w(i);