fplot
Purpose
Plot a single function over a convex set or over an array of convex sets.
Syntax
h = Set.fplot()
h = Set.fplot('name', 'Prop1', value1, 'Prop2', value2)
h = fplot(Set, 'name', 'Prop1', value1, 'Prop2', value2)
Description
Plot single function over a convex set. If there are more functions attached to a set, then the string name identifies
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, use the position property to indicate that
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
Set |
Any object derived from the ConvexSet class, e.g. Polyhedron, YSet, ...
Class: ConvexSet
|
name |
If there are more functions attached to the set, this string indicates the name of the function to plot.
Class: char
|
Prop1 |
Specification of figure properties.
Class: char Allowed values:
-
positionFor vector valued functions, the position indicates which element of the function value to plot.
-
GridWith how many gridpoints to grid the circle/sphere. Default is 20.
-
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 points to plot the contour graph. Default is 30.
-
show_setPlot the domain of the function. Default is false.
-
showgridShow the grid inside the set. Default is false.
-
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 set. The set is an interval [-1, 2] P = Polyhedron('lb',-1,'ub',2);
Assign a quadratic function
under name "f" to the set P
Q = QuadFunction(1,-1,3);
P.addFunction(Q,'f');
Plot the function P.fplot

Example
2
We have two linear functions "a", "b" over a convex set. Construct the set first as the intersection of a circle and linear inequality x = sdpvar(2,1);
F = [0.5*x'*x<=0.2; [-1, 0.6]*x<=0.5];
S = YSet(x,F);
Construct quadratic and linear function. Q = QuadFunction([1 -2;3 0.5],[-1,0], -1.4);
L = AffFunction([2.6,-0.2], 0.7);
Add functions to the set with names "a" and "b". S.addFunction(Q,'a');
S.addFunction(L,'b');
Plot the function "b" based on the function name S.fplot('b');

Example
3
We have three affine and vector valued functions over the set S. Construct the set first as the intersection of a circle and linear inequality x = sdpvar(2,1);
F = [0.5*x'*x<=0.2; [-3,0.4]*x<=0.5];
S = YSet(x,F);
Construct three affine functions and put them in an array. A1 = AffFunction([-0.4,0.9; -1, 0.3], [0.4; 0.7]);
A2 = AffFunction([0.7,-0.1; -2, 0.7], [0.3; -0.1]);
A3 = AffFunction([0.7,-0.1; -0.6 5], [0.3; 0.2]);
add these functions to the set S with some names S.addFunction(A1, 'mon');
S.addFunction(A2, 'wed');
S.addFunction(A3, 'fri');
Plot the second element of the function "fri" in gray color. S.fplot('fri','position',2,'Color','gray')

Plot the second element of the function "mon" and the underlying domain with some transparency. S.fplot('mon','position',2,'show_set',true,'alpha',0.6,'colororder','random')

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