function y=castel2(p,t)
% computes the Bézier curve with control points p(:,1), p(:,2), ... , p(:,end)
% in the point t

% test with for i=1:length(t); b(:,i)=castel2(p,t(i));end

for i=length(p):-1:2
  p(:,1:i-1)=(1-t)*p(:,1:i-1) + t*p(:,2:i);
end
y=p(:,1);
