getFunction

Purpose

Extract function from PolyUnion object.

Syntax

Un = U.getFunction(name)
Un = getFunction(U,name)

Description

Extract single function from the PolyUnion object, if it has some functions associated to the sets. The extraction is based on the string under which the functions are stored. This method is useful for retrieving particular data from the result returned by parametric solver which contains typically functions such as "primal", "obj" corresponding to primal solution and objective function.

Input Arguments

U

Union of polyhedra in the same dimension.

Class: PolyUnion

name

Name of the function to extract given as string.

Class: string

Example(s)

Example 1

Create a partition by triangulation of polyhedron ../../../../../../fig/mpt/modules/geometry/unions/@PolyUnion/getfunction1.png.
P = 5*ExamplePoly.randVrep;
 Triangulate the polyhedron 
 T = P.triangulate; 
 Assign two functions to each polyhedron and give them names "a" and "b".
 for i=1:numel(T),
                 T(i).addFunction(AffFunction(randn(1,2)),'a');
                 T(i).addFunction(Function(@(x)norm(x,Inf)),'b');
              end
        
Create the union of polyhedra by specifying some properties.
 U = PolyUnion('Set',T,'convex',true,'overlaps',false,'fulldim',true,'bounded',true) 
PolyUnion in the dimension 2 with 3 polyhedra.
Properties of the union: 
  Convex: 1
  Overlaps: 0
  Connected: 1
  Bounded: 1
  FullDim: 1
Functions : 2 attached "a", "b"
Extract only function "b" from the union.
 Un = U.getFunction('b')
PolyUnion in the dimension 2 with 3 polyhedra.
Properties of the union: 
  Convex: 1
  Overlaps: 0
  Connected: 1
  Bounded: 1
  FullDim: 1
Functions : 1 attached "b"
We can plot the function over partition Un.
 Un.fplot 

../../../../../../fig/mpt/modules/geometry/unions/@PolyUnion/getfunction_img_1.png


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