Demonstration of functions over unions of polyhedra
mpt_demo_functions2
P = 10*ExamplePoly.randVrep
Polyhedron in R^2 with representations: H-rep : Unknown (call computeHRep() to compute) V-rep (redundant) : Vertices 10 | Rays 0 Functions : noneTriangulate the polyhedron to get a complex.
T = P.triangulate
Array of 4 polyhedra.For each of the polyhedron, assign affine function
for i=1:numel(T) T(i).addFunction(AffFunction(eye(2),[-1;1]),'phi'); endConstruct the polyunion object U.
U = PolyUnion('Set',T,'FullDim',true,'Bounded',true,'Overlaps',false,'Convex',true)
PolyUnion in the dimension 2 with 4 polyhedra. Properties of the union: Convex: 1 Overlaps: 0 Connected: 1 Bounded: 1 FullDim: 1 Functions : 1 attached "phi"Plot the function over the polyhedra
U.fplot
for i=1:3 Q(i) = ExamplePoly.randVrep+5*rand(2,1); endAssign two quadratic functions to each of the polyhedra.
for i=1:3 Q(i).addFunction(QuadFunction(eye(2),randn(1,2),randn(1)),'alpha'); Q(i).addFunction(QuadFunction(eye(2),randn(1,2),randn(1)),'beta'); endCreate union without specifying any properties.
PU = PolyUnion(Q)
PolyUnion in the dimension 2 with 3 polyhedra. Functions : 2 attached "alpha", "beta"Plot the functions over polyhedra.
PU.fplot('beta')
PU.fplot('beta','show_set',true)
◀ | mpt_demo_lti2 | mpt_demo_lti4 | ▶ |
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch