home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 5.ddi / SPLINES.DI$ / SORTED.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  731 b   |  20 lines

  1. function pointer=sorted(knots, points)
  2. % SORTED    Locate data points in knot sequence.
  3. %
  4. %        pointer=sorted(knots, points)
  5. %
  6. % given  o r d e r e d  sequences  knots  and  points,  returns the index 
  7. % sequence  pointer  (a  r o w  vector)  for which  
  8. %
  9. %   pointer(j) = #{ i : knots(i)  <=  points(j) },  all  j .
  10. %
  11. % If the input is  n o t  o r d e r e d , the output will not mean much.
  12.  
  13. % C. de Boor / latest change: May 27, 1989
  14. % Copyright (c) 1990-92 by Carl de Boor and The MathWorks, Inc.
  15.  
  16. diff(sort([points(:)' knots(:)'])); tol=min(ans(find(ans>0)))/3;
  17. ll=length(points)+length(knots);
  18. [junk,index]=sort([knots(:)' points(:)']+[1:ll]*tol/ll);
  19. pointer=find(index>length(knots))-[1:length(points)];
  20.