function [Ps,As]=singleKnot(ts) %function [Ps,As]=singleKnot(ts) Construct matrices to handle single knot removal, %given the positions of the seven surrounding knots. if min(size(ts)) > 1 error('The input should be a vector.'); end if max(size(ts)) ~= 7 error('7 knots are expected for the input.'); end a2=(ts(4)-ts(1))/(ts(5)-ts(1)); b2=1-a2; a3=(ts(4)-ts(2))/(ts(6)-ts(2)); b3=1-a3; a4=(ts(4)-ts(3))/(ts(7)-ts(3)); b4=1-a4; Ps=[1, 0, 0, 0;b2, a2, 0, 0;0, b3, a3, 0;0, 0, b4, a4;0, 0, 0, 1]; As=pinv(Ps);