home *** CD-ROM | disk | FTP | other *** search
- function tstar=aveknt(t,k)
- % AVEKNT Provide knot averages.
- %
- % tstar=aveknt(t,k)
- %
- % returns the averages of successive k-1 knots, i.e., the points
- %
- % tstar(i) = (t_{i+1} + ... + t_{i+k-1})/(k-1)
- %
- % recommended as good interpolation point choices when interpolating from
- %
- % S_{k,t} .
-
- % C. de Boor / latest change: May 25, 1989
- % C. de Boor / latest change: March 22, 1991 (program around a MATLAB
- % discontinuity)
- % Copyright (c) 1990-92 by Carl de Boor and The MathWorks, Inc.
-
- t=t(:);lt=length(t);
- if (k<2), tstar=[], error('second argument must be at least 2');
- elseif (k==2), tstar=t(2:lt-1)';
- else,
- n=lt-k;
- t*ones(1,k-1);
- junk=ans(:);
- try=zeros(n+k+1,k-1);
- try(:)=[junk;zeros(k-1,1)];
- sum(try')/(k-1);
- tstar=ans(1+[1:n]);
- end
-