fplot

Purpose

Plot function over the union of polyhedra.

Syntax

h = Set.fplot()
h = Set.fplot('name', 'Prop1', value1, 'Prop2', value2)
h = fplot(Set, 'name', 'Prop1', value1, 'Prop2', value2)

Description

Plot function over the union of polyhedra. If there are more functions, then the string name indicates the function to be plotted. If the function is vector valued, i.e. its range is greater than 1, than the first element of the function is plotted by default. For vector valued functions the position property indicates which element of the function value to plot. Figure properties, such as color, line width, etc, can be specified with "Property" - "Value" pairs.

Input Arguments

U

PolyUnion object that contains polyhedra in the same dimension with associated functions.

Class: PolyUnion

name

If there are more functions over one set, the string name identifies the function to be plotted. This argument can be omitted if only one function is attached to a set.

Class: char

Prop1

Specification of figure properties.

Class: char

Allowed values:

  • position

    For vector valued functions, the position indicates which element of the function value to plot.
  • Grid

    With how many gridpoints to grid the circle/sphere. Default is 20.
  • Color

    The color of the plot specified by real RGB vector or a string name of the color (e.g. 'gray');
  • Wire

    Highlight the edges of the set. Default is false.
  • LineStyle

    Specify the type of the line to plot edges of the set. Accepted values are '-',':','-.','--', and'none'.
  • LineWidth

    Specify the width of the line. Default is 1.
  • Alpha

    Transparency of the color. The value must be inside [0,1] interval. Default is 1.
  • Contour

    Add contour graph. Default is false.
  • ContourGrid

    With how many grid points to plot the contour graph. Default is 30.
  • show_set

    Plot the domain of the function. Default is false.
  • showgrid

    Show the grid inside the set. Default is false.
  • colormap

    Color map to use given as a string or a function handle. Default is 'mpt'.
  • colororder

    Either 'fixed' or 'random'. Default is 'fixed'.

value1

Assigns value to Prop1.

Output Arguments

h

Handle related to graphics object.

Class: handle

Example(s)

Example 1

We have piecewise affine function defined over a union of convex sets. Construct the set of four polyhedra in 1D.
 P(1) = Polyhedron('lb',-5,'ub',-1); 

 P(2) = Polyhedron('lb',-1,'ub',1); 

 P(3) = Polyhedron('lb',1,'ub',4); 

 P(4) = Polyhedron('lb',4,'ub',5); 
 Add affine functions to these sets 
 P(1).addFunction(AffFunction(-2,1),'a'); 

 P(2).addFunction(AffFunction(0.1,3.1),'a'); 

 P(3).addFunction(AffFunction(-0.2,3.4),'a'); 

 P(4).addFunction(AffFunction(2,-5.4),'a'); 
 Construct the union saying that it is convex, non-overlapping, bounded, and full-dimensional. 
 U = PolyUnion('Set',P,'convex',true,'overlaps',false,'bounded',true,'fulldim',true) 
PolyUnion in the dimension 1 with 4 polyhedra.
Properties of the union: 
  Convex: 1
  Overlaps: 0
  Connected: 1
  Bounded: 1
  FullDim: 1
Functions : 1 attached "a"
Plot the functions over the union with the line width equal 3 and by showing the polyhedra as well.
 U.fplot('a','LineWidth',3,'show_set',true); 

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

Example 2

Plot piecewise-quadratic function Generate a polygon.
 v = [-1, 1.7; 1.1, 0.5; 0, 2.3; 1, -1.7; 0, -2.3; -1.1 -0.5]; 

 Q = Polyhedron(v);  
 Triangulate the polygon and create an union of polyhedra.
 T = PolyUnion('Set',Q.triangulate,'Convex',true,'overlaps',false) 
PolyUnion in the dimension 2 with 4 polyhedra.
Properties of the union: 
  Convex: 1
  Overlaps: 0
  Connected: 1
Functions : none
Attach a quadratic function over this union and name it "power".
 T.addFunction(QuadFunction(diag([1,2.3]),[-3,0.5],5),'power') 
PolyUnion in the dimension 2 with 4 polyhedra.
Properties of the union: 
  Convex: 1
  Overlaps: 0
  Connected: 1
Functions : 1 attached "power"
Plot the function over the union with random color, transparency equal 0.4, and show grid.
 T.fplot('colororder','random','show_set',true,'alpha',0.4,'showgrid',true) 

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

See Also

plot


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

© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk