function [x_out,y_out]=pseudoKnot(x_cp,y_cp,P,k) % function [x_out,y_out]=pseudoKnot(x_cp,y_cp,P,k) adds a new knot at % position k, using the refinement matrix P. [s1,s2]=size(P); if s1 ~= 5 & s2 ~=4 error('The size of P should be 5x4.'); end if min(size(x_cp)) > 1 error('The first parameter should be a vector.'); end if min(size(y_cp)) > 1 error('The second parameter should be a vector.'); end if max(size(x_cp)) ~= max(size(y_cp)) error('The first two vectors must have the same length'); end s=max(size(x_cp)); x_out=zeros(1,s+1); y_out=zeros(1,s+1); x_out(1:k-3)=x_cp(1:k-3); y_out(1:k-3)=y_cp(1:k-3); x_out(k+3:s+1)=x_cp(k+2:s); y_out(k+3:s+1)=y_cp(k+2:s); x_out(k-2:k+2)=x_cp(k-2:k+1)*P'; y_out(k-2:k+2)=y_cp(k-2:k+1)*P';