Attach function to a convex set.
Set = addFunction(Set,F,FuncName)
Set.addFunction(Set,F,FuncName)
Set |
Any object derived from the ConvexSet class, e.g. Polyhedron, YSet, ... Class: ConvexSet |
F |
Function or an array of functions to be assigned, given as objects derived form Function class. Class: Function |
FuncName |
A string or an cell array of strings that represent the name of the assigned function. Every function must
have an unique name. Class: struct |
Set |
Modified object of ConvexSet class that has a function stored under the Func property. Class: ConvexSet |
P = Polyhedron(1, 1)
Polyhedron in R^1 with representations: H-rep (redundant) : Inequalities 1 | Equalities 0 V-rep : Unknown (call computeVRep() to compute) Functions : noneDefine a function over
F = QuadFunction(3,0,1)
Quadratic Function: R^1 -> R^1Assign a function F to this set P under name "f".
P.addFunction(F,'f')
Polyhedron in R^1 with representations: H-rep (redundant) : Inequalities 1 | Equalities 0 V-rep : Unknown (call computeVRep() to compute) Functions : 1 attached "f"
P1 = Polyhedron(1,1); P2 = Polyhedron(-1,-1);Put the polyhedra to one array.
P = [P1, P2];Define function
F = Function(@(x)x/(x-1))
Function: @(x)x/(x-1)Add the function to each of the polyhedron in the array P and give it the name "f".
P.addFunction(F,'f')
Array of 2 polyhedra.
x = sdpvar(2,1); Set = YSet(x, [norm(x)<=1]);Define the functions
f1 = Function(@(x) sqrt(x(1)^2+x(2)^2+1)); f2 = Function(@(x) (x(1)-2)/(x(2)+3));Add these functions to the circle Set
Set.addFunction(f1, 'polynomial')
YALMIP set in dimension 2. Functions : 1 attached "polynomial"
Set.addFunction(f2, 'rational')
YALMIP set in dimension 2. Functions : 2 attached "polynomial", "rational"Plot the functions above the set
Set.fplot('polynomial')
Set.fplot('rational')
◀ | mpt | distance | ▶ |
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch