THMMY's "Optimization Techniques" course assignments.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

ProjectionPoint.m 554 B

123456789101112131415161718
  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