Home > 13-Two-View-Geometry > Functions > plot_ellipse_mc.m

plot_ellipse_mc

PURPOSE ^

plot ellipse from mean and covariance matrix

SYNOPSIS ^

function h = plot_ellipse_mc(mu,cov,p_typ,lw)

DESCRIPTION ^

 plot ellipse from mean and covariance matrix

 plot_ellipse_mc(mu,cov,p_typ)
 mu = centre
 cov = covariance matrix
 p_typ = point type

 Wolfgang Förstner 10/2010
 wfoerstn@uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % plot ellipse from mean and covariance matrix
0002 %
0003 % plot_ellipse_mc(mu,cov,p_typ)
0004 % mu = centre
0005 % cov = covariance matrix
0006 % p_typ = point type
0007 %
0008 % Wolfgang Förstner 10/2010
0009 % wfoerstn@uni-bonn.de
0010 
0011 
0012 function h = plot_ellipse_mc(mu,cov,p_typ,lw)
0013 
0014 if nargin < 4
0015     lw = 2;
0016 end
0017 
0018 e = sqrt(eigs(cov));
0019 a = e(1);
0020 b = e(2);
0021 theta = atan2(2*cov(1,2),cov(1,1)-cov(2,2))/2;
0022 
0023 np = 100;
0024 ang = (0:np)*2*pi/np;
0025 R = [cos(theta) -sin(theta); sin(theta) cos(theta)];
0026 pts = mu*ones(size(ang)) + R*[cos(ang)*a; sin(ang)*b];
0027 
0028 h = plot( pts(1,:), pts(2,:) , p_typ,'LineWidth',lw);

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005