home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 5.ddi / SPLINES.DI$ / AUGKNT.M next >
Encoding:
Text File  |  1993-03-11  |  1.0 KB  |  27 lines

  1. function [augknot,addl]=augknt(knots,k,mults)
  2. % AUGKNT    Augment a knot sequence.
  3. %
  4. %        [augknot,addl]=augknt(knots,k[,mults])
  5. %
  6. % returns an augmented knot sequence which has the first and last knot with
  7. % exact multiplicity  k . (This may actually shorten the knot sequence.)
  8. % Also returns the number of knots added on the left. (This may be negative.)
  9. %
  10. %   If the third argument is present, the augmented knot sequence will, in 
  11. % addition, contain each interior knot  mults  times. If  knots  is strictly
  12. % increasing, this insures that the splines of order  k  with knotsequence
  13. %  augknot  satisfy  k-mults  smoothness conditions across each interior knot.
  14.  
  15. % C. de Boor / latest change: Feb.25, 1989
  16. % Copyright (c) 1990-92 by Carl de Boor and The MathWorks, Inc.
  17.  
  18. if (nargin==3),ones(mults,1)*knots(:)';knots=ans(:)';end
  19.    
  20. km1=k-1;
  21. augknot=[knots(1)*ones(1,km1) knots(:)' knots(length(knots))*ones(1,km1)];
  22.  
  23. index=find(diff(augknot)>0);
  24. augknot=augknot(index(1)-km1:index(length(index))+k);
  25.  
  26. find(diff(knots)>0);addl=k-ans(1);
  27.