Using for example Wolfram alpha definition of Bspline basis functions, the basis functions of order p=3 (cubic) and knotvector = [0,0,0,0, 0.2, 0.5, 0.5, 0.5 , 0.8, 1,1,1,1] looks like this:
As you can see, the last basis function approaches one as x approaches 1, but when x equal 1, the last basis function becomes 0.
Why is this. I have copied the definition exactly, so it should work in the end points also, right?
Furthermore, if i insert one more knotpoint, 0.5, to get a discontinous basefunction in the middle, I get the same problem (knotvector is now [0,0,0,0, 0.2, 0.5, 0.5, 0.5, 0.5, 0.8, 1,1,1,1]):
Here is my code if anyone is intrested (p=order, i=basefunction (starts from 1)):
function _bspline_basis_value_debug(p::Int, knot::Vector{Float64}, i::Int, xi)
if p>0
_N1_1 = (xi - knot[i])*_bspline_basis_value_debug(p-1, knot, i, xi)
_N1_2 = (knot[i+p]-knot[i])
if _N1_2 == 0.0 && _N1_1 == 0.0
_N1 = 0.0
else
_N1 = (_N1_1/_N1_2)
end
_N2_1 = (knot[i+p+1] - xi)*_bspline_basis_value_debug(p-1, knot, i+1, xi)
_N2_2 = (knot[i+p+1] - knot[i+1])
if _N2_2 == 0.0 && _N2_1 == 0.0
_N2 = 0.0
else
_N2 = (_N2_1/_N2_2)
end
return _N1+_N2
else
if knot[i] <= xi < knot[i+1]
return 1.0
else
return 0.0
end
end
end


The problem with the right most basis function going to zero is answered here Behaviour of a clamped Bspline curve at t=1.0
The second problem happens becuase one is not supposed to have p+1 multiple knots in the knotvector...