www.pudn.com > trackingdemos.zip > get_ellipsoid_gate.m


% function [X, Y] = get_ellipsoid_gate(center, covariance, g) 
% 
% get the ellipsoid gate around the center 
% useful for two dimensional plot of the estimated/predicted position 
% 
% center --- two dimensional position 
% covariance --- two dimensional covariance matrix 
% g --- size of the gate, default g=2 
% X --- position of ellipsoid gate along X-axis 
% Y --- position of ellipsoid gate along Y-axis 
 
% by Huimin Chen, 09/10/01 
function [X, Y] = get_ellipsoid_gate(center, covariance, g) 
if nargin < 3 
    g=2; 
end 
 
[V, D] = eig(covariance); 
d = diag(D); 
theta = linspace(0.01,2*pi,100); 
d1 = [d(1).*cos(theta); d(2).*sin(theta)]; 
d2 = V * d1; 
X = d2(1,:)+center(1); 
Y = d2(2,:)+center(2);