%BSpline.m %Math 128B Spring 2005 %Returns B1(i,j)=Bj1(Xi) % =j'th B-spline (with k=1) evaluated at Xi % = characteristic function over [knots(j),knots(j+1)] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function B1 = BSpline(t, knots) %t = discretization of domain %knots = row vector of knot locations N = length(knots); M = length(t); TT = repmat(t', 1, N-1); KNOTS = repmat(knots, M, 1); B1(:,1:N-1) = 0.5 * (sign(TT - KNOTS(:,1:N-1)) - sign(TT - KNOTS(:,2:N))); return