Computes the closest distance between the convex set and given point.
ret = distance(Set,x)
ret = Set.distance(x)
Set |
Any object derived from the ConvexSet class, e.g. Polyhedron, YSet, ... Class: ConvexSet |
x |
A point given as a real vector with the same dimension as the convex set. Class: double |
ret |
Structure that contains the information about the computed distance and the points ![]() ![]() Class: struct |
ret.exitflag |
Termination status from the related optimization problem. Class: double |
ret.dist |
Distance between the point x and the convex Set. Class: double |
ret.y |
The point that is contained in the convex Set and is closest to x. Class: double |
ret.x |
The point x that was provided. Class: double |
z = sdpvar(2,1);Define a set S using YSet class
options = sdpsettings('solver','sedumi','verbose',0);
S = YSet(z, [norm(z)<=1; randn(2)*z<=0.5*ones(2,1)], options);Compute the distance to a point [-5;8]
x = [-5; 8];
d = S.distance(x)
d = exitflag: 1 dist: 8.43398113093422 x: [2x1 double] y: [2x1 double]We can plot the set and the points x, y
S.plot('alpha',0.5,'color','green'); hold on; text(x(1),x(2),'x'); axis([-3 2 -2 3]); text(d.y(1),d.y(2),'x');
Plotting... 27 of 40
◀ | addfunction | outerapprox | ▶ |
© 2010-2013 Colin Neil Jones: EPF Lausanne, colin.jones@epfl.ch
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch