function y = bspline(x,m)
% Evaluates the cardinal B-spline.
%
% x       evaluation nodes
% m       order
%
% Course in Wavelets, TU Chemnitz, 2008

if m == 1
   y = zeros(size(x));
   y((x>=0) & (x<1))=1;
else
  y = x./(m-1).*bspline(x,m-1) + (m-x)./(m-1).*bspline(x-1, m-1);
end
