Something went wrong when you quoted your code. There should be a preview pane to the right of your input pane that will show you whether you did it correctly.
You should use triple backticks for quoting. Looks like you used something else.
Please use three back-tics like this ``` to quote your code.
The following gives no errors, please copy paste and report back if you get errors.
function Bspline(p,knot,t)
nb = size(knot,2)-p-1
Bspln = zeros(nb,p+1)
for ip = 0:p
for i = 1:(nb-ip)
Bspln[i,ip+1] = 0
end
end
return Bspln
end
p = 3
knot = [-1 -1 -1 -1 0 1 1 1 1]
knot = [knot ones(1,p)]
nb = size(knot,2)-p-1
ndt = 10 # t steps
t1 = minimum(knot)
t2 = maximum(knot)
t = t1:(t2-t1)/ndt:t2
nt = size(t,1)
y = zeros(nb,p+1,nt)
for it = 1:nt
Bspln = Bspline(p,knot,t[it])
end