home *** CD-ROM | disk | FTP | other *** search
- function [v,b] = splpp(tx,a)
- % SPLPP Convert locally from B-form to pp-form.
- %
- % [v,b] = splpp(tx,a)
- %
- % uses knot insertion to derive from the B-spline coefficients
- % a(.,:) relevant for the interval [tx(.,k-1), tx(.,k)] (with respect
- % to the knot sequence tx(.,1:2(k-1)) ) the B-spline coefficients
- % b(.,1:k) relevant for the interval [tx(.,k-1),0] (with respect
- % to the knot sequence [tx(.,1:k-1),0,...,0] ), with [ ,k]:=size(a) .
- %
- % It is assumed that tx(.,k-1) < 0 <= tx(.,k) .
- %
- % From this, computes v(j) := D^{k-j}s(0-)/(k-j)! , j=1,...,k , with s the
- % spline described by the given knots and coefficients.
-
-
- % C. de Boor / latest change: Feb.25, 1989
- % Copyright (c) 1990-92 by Carl de Boor and The MathWorks, Inc.
-
-
- [junk,k]=size(a); km1=k-1;b=a;
- for r=1:km1;
- for i=km1:-1:r;
- b(:,i+1) = (tx(:,i+k-r)*b(:,i)-tx(:,i)*b(:,i+1))/(tx(:,i+k-r)-tx(:,i));
- end
- end
- end
-
- % Use differentiation at 0 to generate the derivatives
-
- v=b;
- for r=1:km1;
- factor = (k-r)/r;
- for i=1:k-r;
- v(:,i) = (v(:,i) - v(:,i+1))*factor./tx(:,i+r-1);
- end
- end
-
- % Note: the first B-spline has knots tx_0,...,tx_k, but its evaluation only
- % uses tx_1,...,tx_k . Similarly, the evaluation of the last, or k-th, B-spline
- % only requires its `interior' knots tx_k,...,tx_(2k-2) .
- %
- % Since the first B-spline has knots tx_0,...,tx_k , we have t_j=tx_(j-1) in
- % the usual formulae. E.g., in the first step, we overwrite
- % a(j) by (-tx_(j-1)a(j)+tx_(j+k-2)a(j-1))/(-tx_...+tx_...) ,
- % and do this for j=2,...,k.
-