fplot
Purpose
Plot single function over the polyhedron or array of polyhedra.
Syntax
h = P.fplot()
h = P.fplot('name', 'Prop1', value1, 'Prop2', value2)
h = fplot(P, 'name', 'Prop1', value1, 'Prop2', value2)
Description
Plot single function over a polyhedron or array of polyhedra. If there are more functions, then name indicates
the string under which the function is attached to a set.
If the function is vector valued, i.e. its range is greater than 1,
than the first element of the function value is plotted by default. For vector valued functions
use the position property if you want a different element of the function value to plot.
Figure properties, such as color, line width, etc, can be specified with "Property" - "Value" pairs.
Input Arguments
Polyhedron |
Polyhedron in any format.
Class: Polyhedron
|
name |
If there are more functions associated to the polyhedron, the name indicates the
function name. By default, only the first function is plotted.
Functions can be accessed by referring to Func property.
Class: char
Default: 1
|
dim |
For vector valued functions, the dim indicates which element of the vector to plot.
Class: double
Default: 1
|
Prop1 |
Specification of figure properties.
Class: char Allowed values:
-
positionFor vector valued functions, the position indicates which element of the function value to plot.
-
ColorThe color of the plot specified by real RGB vector or a string name of the color (e.g. 'gray').
-
WireHighlight the edges of the set. Default is false.
-
LineStyleSpecify the type of the line to plot edges of the set. Accepted values are '-',':','-.','--', and'none'.
-
LineWidthSpecify the width of the line. Default is 1.
-
AlphaTransparency of the color. The value must be inside [0,1] interval. Default is 1.
-
ContourAdd contour graph. Default is false.
-
ContourGridWith how many grid point to do the contour graph. Default is 30.
-
show_setPlot the polyhedron with the function. Default is false.
-
showgridShow the grid inside the set. Default is false.
-
GridWith how many gridpoints to grid the polyhedron. Default is 20.
-
ColorMapColor map given either as a M-by-3 matrix, or as a string. Default is 'mpt'.
Other available options are 'hsv', 'hot', 'gray', 'lightgray', 'bone', 'copper',
'pink', 'white', 'flag', 'lines', 'colorcube','vga', 'jet', 'prism', 'cool',
'autumn', 'spring', 'winter', 'summer'.
-
ColorOrderEither 'fixed' for fixed ordering of colors, or 'random' for a random order. Default is 'fixed'.
|
value1 |
Assigns value to Prop1. |
Output Arguments
h |
Handle related to graphics object.
Class: handle
|
Example(s)
Example
1
Plot one function over one dimensional polyhedron. The set is an interval [0, 1] P = Polyhedron('lb',0,'ub',1);
Assign a quadratic function
under name "f" to it Q = QuadFunction(1,0,1);
P.addFunction(Q,'f');
Plot the function "f" with the polyhedron in dark olive green color. P.fplot('f','show_set',true,'Color','darkolivegreen','LineWidth',3)

Example
2
We have two linear functions "friction", "gain" over one polyhedron. Construct the functions. The first function maps from
. L1 = AffFunction([3 -1],2)
Affine Function: R^2 -> R^1
The second function is vector valued because it maps from
. L2 = AffFunction([1 0; -1 -2], [0.7;0.1])
Affine Function: R^2 -> R^2
Add functions to the set with names "friction" and "gain". S = ExamplePoly.randVrep;
S.addFunction(L1,'friction');
S.addFunction(L2,'gain');
Plot first elements from both functions S.fplot('friction','color','b'); hold on; S.fplot('gain','color','m'); hold off

Plot the second element of the vector valued function "gain" over the wired polyhedron. S.fplot('gain','position',2,'show_set',true,'wire',true);

Example
3
Create a triangle from three points. T = Polyhedron([0,0;4,1;1,3]);
Attach a quadratic function "energy" over the set T. T.addFunction(QuadFunction(0.5*eye(2),[-1, 0.6]),'energy');
Plot the function over the set and show grid T.fplot('showgrid',true,'wire',true,'linewidth',3,'show_set',true,'color','lightsteelblue');

See Also
plot
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch
© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk