wolffd@0: function h = draw_ellipse_axes(x, c, linespec) wolffd@0: % DRAW_ELLIPSE_AXES(x, c, linespec) wolffd@0: % Draws the major and minor axes of ellipses. wolffd@0: % Ellipses are centered at x with covariance matrix c. wolffd@0: % x is a matrix of columns. c is a positive definite matrix. wolffd@0: % linespec is optional. wolffd@0: wolffd@0: [v,e] = eig(c); wolffd@0: v = v*sqrt(e); wolffd@0: wolffd@0: h = []; wolffd@0: for j = 1:cols(v) wolffd@0: x1 = repmat(x(1,:),2,1) + repmat([-1;1]*v(1,j),1,cols(x)); wolffd@0: x2 = repmat(x(2,:),2,1) + repmat([-1;1]*v(2,j),1,cols(x)); wolffd@0: h = [h line(x1,x2)]; wolffd@0: end wolffd@0: if nargin > 2 wolffd@0: set_linespec(h,linespec); wolffd@0: end