📄 ndellipse.c
字号:
/*
Returns coordinates x,y of a ellipso飀s given (M,S), the mean vector and covariance matrix.
ND splices permitted
Usage [x , y] = ndellipse(M , S , [H] , [R] , [N]);
------
Inputs
-------
M : Mean vector (d x 1 x [n1] , ... , [nl])
S : Covariance (d x d x [n1] , ... , [nl])
H : Transfert Matrix (2 x d) (default H = eye(2 , d))
R : Such that y'Sy < R (default R = 2.44774683 = sqrt(chi2inv(0.95 , 2)))
N : Number of points to draw ellipsoids (default N = 50)
Outputs
-------
x : x-coordinate (1 x N x [n1] , ... , [nl])
y : y-coordinate (1 x N x [n1] , ... , [nl])
Example 1
--------
M = randn(2 , 1);
S = [3.2 , 0.2 ; 0.22 , 2.2];
[x , y] = ndellipse(M , S);
plot(x , y);
Example 2
--------
nbe = 4;
M = randn(3 , 1 , nbe);
S = repmat(([3.2 , 0.2 , 0.3; 0.2 , 1.1 , 0.25 ; 0.3 , 0.25 , 2.2]) , [1 , 1 , nbe]);
H = [1 0 0 ; 0 1 0];
R = sqrt(chi2inv(0.95 , 2));
N = 30;
[x , y] = ndellipse(M , S , H , R , N);
plot(x , y , 'linewidth' , 2);
To compile :
------------
mex -output ndellipse.dll ndellipse.c
Myself, I use Intel CPP compiler as :
mex -f mexopts_intel10amd.bat -output ndellipse.dll ndellipse.c
Ver 1.0 (03/04/05)
Author : S閎astien PARIS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -