THMMY's "Optimization Techniques" course assignments.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

20 rindas
513 B

  1. function [flag] = BelongsTo(x, SetLimmits)
  2. %Checks if the x vector belongs to Set
  3. %
  4. % x: A vector to project
  5. % SetLimmits: The set to project. Each line/dimension off the set has to contain the limits
  6. % of the set to that particular dimension
  7. % flag: True if belongs
  8. %
  9. flag = true; % Have faith
  10. for i = 1:size(SetLimmits, 2)
  11. if x(i) < SetLimmits(i,1)
  12. flag = false;
  13. elseif x(i) > SetLimmits(i,2)
  14. flag = false;
  15. end
  16. end
  17. end