%% 2-D Bezier Curve
%% 1

P = [0 1; 4 3; 6 2; 3 0; 2 4];
syms t
B = bernsteinMatrix(4, t);
bezierCurve = simplify(B*P);

%
%% 2

fplot(bezierCurve(1), bezierCurve(2), [0, 1])
hold on
scatter(P(:,1), P(:,2),'filled')
title('Fourth-order Bezier curve')
hold off

% Copyright 2012 The MathWorks, Inc.