function y=castel2b(x,t)
% computes the x coordinate of the Bézier curve with control points abcissas x(1), x(2), ... x(end)
% in the entries of the vector t

% test with bb=[castel2b(p(1,:),t); castel[1;5C2b(p(2,:),t)];

x=x(:);t=t(:)'; %x as column, t as row
y=repmat(x,1,length(t));
for i=length(x):-1:2
  y(1:i-1,:) = bsxfun(@times, y(1:i-1,:) , 1-t) + bsxfun(@times, y(2:i,:), t);
end
y=y(1,:);

