mpt_demo_functions2

Purpose

Demonstration of functions over unions of polyhedra

Syntax

mpt_demo_functions2

Description

Demonstration of functions over unions of polyhedra.

Example(s)

Example 1

Constructing union of triangular polyhedra Create random polyhedron
 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 : none
Triangulate 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');
            end
        
 Construct 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 

../../../fig/mpt/demos/mpt_demo_functions2_img_1.png

Example 2

Construct overlapping union Create 3 random polyhedra.
            for i=1:3
            Q(i) = ExamplePoly.randVrep+5*rand(2,1);
            end
        
 Assign 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');
            end
        
 Create 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') 

../../../fig/mpt/demos/mpt_demo_functions2_img_2.png

Plot the functions over polyhedra based with some properties
 PU.fplot('beta','show_set',true) 

../../../fig/mpt/demos/mpt_demo_functions2_img_3.png

See Also

mpt_demo_functions1


© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch