gmm_display_2d_contour.m

来自「高斯滤波器 matlab toolbox For GMMs and Gauss」· M 代码 · 共 29 行

M
29
字号
function x = gmm_display_2D_contour(g, prob, N, type)

if nargin == 3, type=1; end
if prob<=0 | prob>1, error('Probability outside (0, 1] bounds'), end

% Sample gmm and evaluate
x = gmm_samples(g, N);
w = gmm_evaluate(g, x);

% Find weights related to each requested prob
ws = sort(w); 
ws = ws(ceil((1-prob)*N));

% Compute contour
switch type
case 1 % convex hull method
    i = find(w >= ws);
    x = x(:,i);
    k = convhull(x(1,:), x(2,:));
    x = x(:,k);
    
case 2 % search method
    xs = x(:, w == ws);
    % increment-length based on curvature
    
otherwise
    error('No other variations implemented')    
end

⌨️ 快捷键说明

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