THMMY's "Optimization Techniques" course assignments.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

19 行
554 B

  1. function [x_p] = ProjectionPoint(x, SetLimmits)
  2. %Project the x vector to Set, returns a point of Set close(st) to x
  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. %x_p: The projected point
  8. %
  9. x_p = x;
  10. for i = 1:size(SetLimmits, 2)
  11. if x(i) < SetLimmits(i,1)
  12. x_p(i) = SetLimmits(i,1);
  13. elseif x(i) > SetLimmits(i,2)
  14. x_p(i) = SetLimmits(i,2);
  15. end
  16. end
  17. end