20 lines
513 B
Matlab
20 lines
513 B
Matlab
function [flag] = BelongsTo(x, SetLimmits)
|
|
%Checks if the x vector belongs to Set
|
|
%
|
|
% 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
|
|
% flag: True if belongs
|
|
%
|
|
flag = true; % Have faith
|
|
|
|
for i = 1:size(SetLimmits, 2)
|
|
if x(i) < SetLimmits(i,1)
|
|
flag = false;
|
|
elseif x(i) > SetLimmits(i,2)
|
|
flag = false;
|
|
end
|
|
end
|
|
end
|
|
|