Line | |
---|
1 | function [xe,ye]=ellipplot(P,gamma,ecolor,xc) |
---|
2 | %DUAL2CELL Internal function for plotting ellipsoid |
---|
3 | |
---|
4 | % Author Johan Löfberg |
---|
5 | % $Id: ellipplot.m,v 1.2 2004/07/02 08:17:30 johanl Exp $ |
---|
6 | |
---|
7 | if nargin<4 |
---|
8 | xc = zeros(length(P),1); |
---|
9 | end |
---|
10 | |
---|
11 | if nargin<3 |
---|
12 | ecolor = [1 0 0]; |
---|
13 | end |
---|
14 | |
---|
15 | if nargin<2 |
---|
16 | gamma = 1; |
---|
17 | end |
---|
18 | |
---|
19 | P=P/gamma; |
---|
20 | P=chol(P); |
---|
21 | |
---|
22 | theta = linspace(-pi,pi,100); |
---|
23 | z = [cos(theta); sin(theta)]; |
---|
24 | |
---|
25 | x = inv(P)*z; |
---|
26 | for n=1:length(x) |
---|
27 | x(:,n)=x(:,n)+xc; |
---|
28 | end; |
---|
29 | |
---|
30 | fill(x(1,:),x(2,:),ecolor) |
---|
Note: See
TracBrowser
for help on using the repository browser.