function y = bezier(i,n,t)

% y = bezier(i,n,t)
%       calculates the bezier function
%        y = beta_i^n(t) = (n-1)!/((i-1)! (n-i)!) t^{i-1} (1-t)^{n-i}

y = fact(n-1)/(fact(i-1)*fact(n-i)) * power(t,i-1) * power(1-t,n-i);
