19 lines
554 B
Matlab
19 lines
554 B
Matlab
function [x_p] = ProjectionPoint(x, SetLimmits)
|
|
%Project the x vector to Set, returns a point of Set close(st) to x
|
|
%
|
|
% x: A vector to project
|
|
% SetLimmits: The set to project. Each line/dimension off the set has to contain the limits
|
|
% of the set to that particular dimension
|
|
%x_p: The projected point
|
|
%
|
|
x_p = x;
|
|
for i = 1:size(SetLimmits, 2)
|
|
if x(i) < SetLimmits(i,1)
|
|
x_p(i) = SetLimmits(i,1);
|
|
elseif x(i) > SetLimmits(i,2)
|
|
x_p(i) = SetLimmits(i,2);
|
|
end
|
|
end
|
|
end
|
|
|