Rev | Line | |
---|
[37] | 1 | function h = draw_ellipse_axes(x, c, linespec) |
---|
| 2 | % DRAW_ELLIPSE_AXES(x, c, linespec) |
---|
| 3 | % Draws the major and minor axes of ellipses. |
---|
| 4 | % Ellipses are centered at x with covariance matrix c. |
---|
| 5 | % x is a matrix of columns. c is a positive definite matrix. |
---|
| 6 | % linespec is optional. |
---|
| 7 | |
---|
| 8 | [v,e] = eig(c); |
---|
| 9 | v = v*sqrt(e); |
---|
| 10 | |
---|
| 11 | h = []; |
---|
| 12 | for j = 1:cols(v) |
---|
| 13 | x1 = repmat(x(1,:),2,1) + repmat([-1;1]*v(1,j),1,cols(x)); |
---|
| 14 | x2 = repmat(x(2,:),2,1) + repmat([-1;1]*v(2,j),1,cols(x)); |
---|
| 15 | h = [h line(x1,x2)]; |
---|
| 16 | end |
---|
| 17 | if nargin > 2 |
---|
| 18 | set_linespec(h,linespec); |
---|
| 19 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.