The function cov2ellipse in the geometry package is not computing the
ellipse axes correctly. The first problem is that the scale of the
axes is wrong. This can be demonstrated with the code below
######################################################################
function cov2ellipse_demo (K)
L = chol(K,'lower');
u = randn(1e3,2)*L';
elli = cov2ellipse (K);
figure(1)
plot(u(:,1),u(:,2),'.r');
hold on;
drawEllipse(elli,'linewidth',2);
hold off;
axis tight;
endfunction
cov2ellipse_demo (K); ## This is what we get with "demo cov2ellipse"
cov2ellipse_demo (10*K);
cov2ellipse_demo (0.1*K);
######################################################################
This is fixed by taking the square root of the eigenvalues obtained by
svd().
The second problem is that the axis orientation is wrong, evidenced in
the code below:
######################################################################
K = [2 -1; -1 2];
cov2ellipse_demo (K)
######################################################################
This happens because the wrong elements of the eigenvectors are taken.
The patch attached below fixes both problems.
Rafael
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov_______________________________________________
Octave-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev