Line | |
---|
1 | function p = polytope(X) |
---|
2 | % polytope Converts set object to polytope object |
---|
3 | % |
---|
4 | % P = polytope(F) |
---|
5 | % [P,x] = polytope(F) |
---|
6 | % |
---|
7 | % P : polytope object (Requires the Multi-parametric Toolbox) |
---|
8 | % x : sdpvar object defining the variables in the polytope P.H*x<P.K |
---|
9 | % F : set-object with linear inequalities |
---|
10 | |
---|
11 | % Author Johan Löfberg |
---|
12 | % $Id: polytope.m,v 1.3 2005/02/04 10:10:27 johanl Exp $ |
---|
13 | |
---|
14 | |
---|
15 | if all(is(X,'element-wise'))% & all(is(X,'linear')) |
---|
16 | f = []; |
---|
17 | for i = 1:length(X) |
---|
18 | if X.clauses{i}.type==2 |
---|
19 | fi = X.clauses{i}.data; |
---|
20 | f = [f;fi(:)]; |
---|
21 | end |
---|
22 | end |
---|
23 | |
---|
24 | B = full(getbase(f)); |
---|
25 | p = polytope(-B(:,2:end),B(:,1)); |
---|
26 | else |
---|
27 | error('polytope can only be applied to SET objects with linear inequalities.') |
---|
28 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.