%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%tell Binomial function to load the Binomial.mat datafile
Binomial('init');
%specify t-discretization for Bezier curve
h = .001;
figure(31)
CP = [7 4 2 0; 0 -3 -1 0]';
xy = Bezier(CP, h);
plot(CP(:,1),CP(:,2),'-',xy(:,1),xy(:,2),'.');
...etc...
function xy = Bezier(CP,h) %on entry, CP=[column of x-coordinates of control polygon vertices, % column of y-coordinates of control polygon vertices] % h=t-discretization %Returns xy=discretizations of Bezier curve % xy(:,1)=x-coordinates, xy(:,2)=y-coordinates sizeCP = size(CP); N = sizeCP(1); %degree of Bezier polynomial=(N-1) BC = Binomial(N); %returns array of (N-1)!/(j!(N-1-j)!) length=N ... return