Evaluates a function defined over a convex set or an array thereof.
[fval, feasible] = Set.feval(x)
[fval, feasible] = Set.feval(x,function_name)
[fval, feasible] = feval(Set,x,function_name)
Set |
Convex set or an array thereof, i.e. any object derived from the ConvexSet class, e.g. Polyhedron, YSet, ... Class: ConvexSet |
x |
A point at which the function should be evaluated. The point must be given as column and must be in the same dimension as the set. Class: double |
function_name |
String name of the function to evaluate. It must refer
to a single function. If omitted, S.feval(x) only
works if the set has a single function.
Class: char |
fval |
An ![]() ![]() ![]() ![]() Class: double |
feasible |
An ![]() ![]() Class: double |
P = Polyhedron('lb',[-1;-2],'ub',[1;2]);Assign a quadratic function to it
Q = QuadFunction([1 2;-2 3],[0 -5],0.6)
Quadratic Function: R^2 -> R^1
P.addFunction(Q,'q');Obtain the value of the function for the point [-1;-1.5]
x = [-1; -1.5];
y = P.feval(x)
y = 15.85We can plot the function over the set with the point [x,y]
P.fplot; hold on; text(x(1),x(2),y,'\bf{x}','FontSize',14);
P = Polyhedron([1 2;-0.6 8; 0 0.4; 5 -1],[1;2;0.7;0.01])
Polyhedron in R^2 with representations: H-rep (redundant) : Inequalities 4 | Equalities 0 V-rep : Unknown (call computeVRep() to compute) Functions : none
F1 = AffFunction([1 2])
Affine Function: R^2 -> R^1
F2 = AffFunction([3 4; -1 0])
Affine Function: R^2 -> R^2
F3 = AffFunction([5 6; 7 8; 9 -1])
Affine Function: R^2 -> R^3Add functions to a polyhedron with corresponding names in a cell array.
P.addFunction(F1, 'a')
Polyhedron in R^2 with representations: H-rep (redundant) : Inequalities 4 | Equalities 0 V-rep : Unknown (call computeVRep() to compute) Functions : 1 attached "a"
P.addFunction(F2, 'b')
Polyhedron in R^2 with representations: H-rep (redundant) : Inequalities 4 | Equalities 0 V-rep : Unknown (call computeVRep() to compute) Functions : 2 attached "a", "b"
P.addFunction(F3, 'c')
Polyhedron in R^2 with representations: H-rep (redundant) : Inequalities 4 | Equalities 0 V-rep : Unknown (call computeVRep() to compute) Functions : 3 attached "a", "b", "c"Evaluate function "a" for the point [-1;-1]
P.feval([-1;-1],'a')
ans = -3Evaluate functions "b" and "c" for the point [-1;-1]
y1 = P.feval([-1;-1],'b')
y1 = -7 1
y2 = P.feval([-1;-1],'c')
y2 = -11 -15 -8
◀ | fliplr | isbounded | ▶ |
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch
© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk