www.gusucode.com > symbolic 源码程序 matlab案例代码 > symbolic/BernsteinMatrix3DBezierCurveExample.m

    %% 3-D Bezier Curve
%% 1 
P = [0 0 0; 2 2 2; 2 -1 1; 6 1 3];
syms t
B = bernsteinMatrix(3,t);
bezierCurve = simplify(B*P);
%% 2
fplot3(bezierCurve(1), bezierCurve(2), bezierCurve(3), [0, 1])
hold on
scatter3(P(:,1), P(:,2), P(:,3),'filled')
hold off