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